Skip to content

Commit 8e60121

Browse files
authored
Merge pull request #6253 from ampproject/fix/lint-js-job-failure
Fix `lint-js` job failure for dependabot PRs
2 parents 833ba2b + 9549afc commit 8e60121

File tree

2 files changed

+37
-10
lines changed

2 files changed

+37
-10
lines changed

.github/workflows/build-test-measure.yml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,18 +103,24 @@ jobs:
103103
run: npm run lint:pkg-json
104104

105105
- name: Detect ESLint coding standard violations
106-
if: github.event.pull_request.head.repo.fork == true
106+
if: >
107+
github.event.pull_request.head.repo.fork == true ||
108+
github.event.pull_request.user.login == 'dependabot'
107109
run: npm run lint:js
108110

109111
- name: Generate ESLint coding standard violations report
110-
# Prevent generating the ESLint report if run from a PR fork
111-
if: github.event.pull_request.head.repo.fork == false
112+
# Prevent generating the ESLint report if PR is from a fork or authored by Dependabot.
113+
if: >
114+
! ( github.event.pull_request.head.repo.fork == true ||
115+
github.event.pull_request.user.login == 'dependabot' )
112116
run: npm run lint:js:report
113117
continue-on-error: true
114118

115119
- name: Annotate code linting results
116-
# The action cannot annotate the PR diff when run from a PR fork
117-
if: github.event.pull_request.head.repo.fork == false
120+
# The action cannot annotate the PR when run from a PR fork or was authored by Dependabot.
121+
if: >
122+
! ( github.event.pull_request.head.repo.fork == true ||
123+
github.event.pull_request.user.login == 'dependabot' )
118124
uses: ataylorme/[email protected]
119125
with:
120126
repo-token: '${{ secrets.GITHUB_TOKEN }}'
@@ -657,8 +663,11 @@ jobs:
657663

658664
build-zip:
659665
name: 'Build: ${{ matrix.build }} build ZIP'
660-
# Only run if it is not a draft PR and the PR is not from a forked repository.
661-
if: ( github.event.pull_request.draft || github.event.pull_request.head.repo.fork ) == false
666+
# Only run if the PR was not authored by Dependabot and it is not a draft or not from a fork.
667+
if: >
668+
github.event.pull_request.draft == false &&
669+
github.event.pull_request.head.repo.fork == false &&
670+
github.event.pull_request.user.login != 'dependabot'
662671
runs-on: ubuntu-latest
663672
needs:
664673
- lint-css

.github/workflows/qa-integrate.yml

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,12 +71,26 @@ jobs:
7171
- name: Validate package.json
7272
run: npm run lint:pkg-json
7373

74-
- name: Detect coding standard violations (ESLint)
74+
- name: Detect ESLint coding standard violations
75+
if: >
76+
github.event.pull_request.head.repo.fork == true ||
77+
github.event.pull_request.user.login == 'dependabot'
78+
run: npm run lint:js
79+
80+
- name: Generate ESLint coding standard violations report
81+
# Prevent generating the ESLint report if PR is from a fork or authored by Dependabot.
82+
if: >
83+
! ( github.event.pull_request.head.repo.fork == true ||
84+
github.event.pull_request.user.login == 'dependabot' )
7585
run: npm run lint:js:report
7686
continue-on-error: true
7787

7888
- name: Annotate code linting results
79-
uses: ataylorme/[email protected]
89+
# The action cannot annotate the PR when run from a PR fork or was authored by Dependabot.
90+
if: >
91+
! ( github.event.pull_request.head.repo.fork == true ||
92+
github.event.pull_request.user.login == 'dependabot' )
93+
uses: ataylorme/[email protected]
8094
with:
8195
repo-token: '${{ secrets.GITHUB_TOKEN }}'
8296
report-json: 'qa-tester/lint-js-report.json'
@@ -195,7 +209,11 @@ jobs:
195209
release-zip:
196210
name: Build release build ZIP and upload as GHA artifact
197211
needs: [unit-test-php]
198-
if: github.event.pull_request.draft == false
212+
# Only run if the PR was not authored by Dependabot and it is not a draft or not from a fork.
213+
if: >
214+
github.event.pull_request.draft == false &&
215+
github.event.pull_request.head.repo.fork == false &&
216+
github.event.pull_request.user.login != 'dependabot'
199217
runs-on: ubuntu-latest
200218
outputs:
201219
branch-name: ${{ steps.retrieve-branch-name.outputs.branch_name }}

0 commit comments

Comments
 (0)