Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhance(workflows/node.js): suggest fixes with reviewdog (requires pull_request_target) #25154

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 7 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ on:
push:
branches: ["main"]
pull_request:
branches: ["main"]

permissions:
contents: read
pull-requests: write

jobs:
test:
Expand All @@ -22,3 +24,29 @@ jobs:
- run: npm test
env:
FORCE_COLOR: 3

- name: Reviewdog - Apply fixes
if: failure() && github.event_name == 'pull_request'
run: |
npm run fix
if ! git diff --quiet; then
echo "HAS_FIXES=true" >> $GITHUB_ENV
fi

- name: Reviewdog - Setup
if: failure() && github.event_name == 'pull_request' && env.HAS_FIXES == 'true'
uses: reviewdog/action-setup@v1
with:
reviewdog_version: latest

- name: Reviewdog - Suggest changes
if: failure() && github.event_name == 'pull_request' && env.HAS_FIXES == 'true'
env:
REVIEWDOG_GITHUB_API_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git diff | reviewdog \
-name="bcd-linter" \
-f=diff \
-f.diff.strip=1 \
-filter-mode=diff_context \
-reporter=github-pr-review
4 changes: 2 additions & 2 deletions api/AbortController.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@
},
"AbortController": {
"__compat": {
"description": "`AbortController()` constructor",
"mdn_url": "https://developer.mozilla.org/docs/Web/API/AbortController/AbortController",
"description": "`AbortController()` constructor",

Comment on lines +57 to +58

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bcd-linter] reported by reviewdog 🐶

Suggested change
"description": "`AbortController()` constructor",
"description": "`AbortController()` constructor",

"spec_url": "https://dom.spec.whatwg.org/#ref-for-dom-abortcontroller-abortcontroller①",
"tags": [
"web-features:aborting"
Expand Down
6 changes: 3 additions & 3 deletions http/headers/Content-Security-Policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@
"report-sample": {
"__compat": {
"description": "`report-sample` source value",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#report-sample",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bcd-linter] reported by reviewdog 🐶

Suggested change
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#report-sample",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",

"support": {
"chrome": {
"version_added": "59"
Expand Down Expand Up @@ -1152,7 +1152,7 @@
"strict-dynamic": {
"__compat": {
"description": "`strict-dynamic` source value",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#strict-dynamic",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bcd-linter] reported by reviewdog 🐶

Suggested change
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#strict-dynamic",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",

"support": {
"chrome": {
"version_added": "52"
Expand Down Expand Up @@ -1338,7 +1338,7 @@
"unsafe-hashes": {
"__compat": {
"description": "`unsafe-hashes` source value",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#unsafe-hashes",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[bcd-linter] reported by reviewdog 🐶

Suggested change
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy/Sources#unsafe-hashes",
"mdn_url": "https://developer.mozilla.org/docs/Web/HTTP/Headers/Content-Security-Policy#fetch_directive_syntax",

"support": {
"chrome": {
"version_added": "69"
Expand Down
Loading