Skip to content

Commit a6e2f77

Browse files
authored
ci: Refactor/fix external contribution handling (#12724)
This should fix the old behavior... previously, we made a PR against a PR branch when we detected that it was opened by an external contributor. This is problematic, turns out, because external contributors will usually have a fork of the repo and thus the action will fail. Now, instead, we will make a PR against develop when a contributor PR is _merged_. See example PR: #12728
1 parent 968301a commit a6e2f77

File tree

2 files changed

+44
-38
lines changed

2 files changed

+44
-38
lines changed

.github/workflows/build.yml

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -229,44 +229,6 @@ jobs:
229229
message: |
230230
⚠️ This PR is opened against **master**. You probably want to open it against **develop**.
231231
232-
job_external_contributor:
233-
name: External Contributors
234-
needs: job_install_deps
235-
runs-on: ubuntu-20.04
236-
if: |
237-
github.event_name == 'pull_request'
238-
&& (github.event.action == 'opened' || github.event.action == 'reopened')
239-
&& github.event.pull_request.author_association != 'COLLABORATOR'
240-
&& github.event.pull_request.author_association != 'MEMBER'
241-
&& github.event.pull_request.author_association != 'OWNER'
242-
steps:
243-
- uses: actions/checkout@v4
244-
with:
245-
ref: ${{ github.head_ref }}
246-
- name: Set up Node
247-
uses: actions/setup-node@v4
248-
with:
249-
node-version-file: 'package.json'
250-
- name: Check dependency cache
251-
uses: actions/cache/restore@v4
252-
with:
253-
path: ${{ env.CACHED_DEPENDENCY_PATHS }}
254-
key: ${{ needs.job_install_deps.outputs.dependency_cache_key }}
255-
fail-on-cache-miss: true
256-
257-
- name: Add external contributor to CHANGELOG.md
258-
uses: ./dev-packages/external-contributor-gh-action
259-
with:
260-
name: ${{ github.event.pull_request.user.login }}
261-
- name: Create PR with changes
262-
uses: peter-evans/create-pull-request@v6
263-
with:
264-
commit-message: "ref: Add external contributor to CHANGELOG.md"
265-
title: "ref: Add external contributor to CHANGELOG.md"
266-
branch: 'external-contributor/patch-${{ github.event.pull_request.user.login }}'
267-
delete-branch: true
268-
body: This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution.
269-
270232
job_build:
271233
name: Build
272234
needs: [job_get_metadata, job_install_deps]
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: "CI: Mention external contributors"
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
branches:
7+
- develop
8+
9+
jobs:
10+
external_contributor:
11+
name: External Contributors
12+
runs-on: ubuntu-20.04
13+
if: |
14+
github.event.pull_request.author_association != 'COLLABORATOR'
15+
&& github.event.pull_request.author_association != 'MEMBER'
16+
&& github.event.pull_request.author_association != 'OWNER'
17+
&& github.actor != 'dependabot[bot]'
18+
steps:
19+
- uses: actions/checkout@v4
20+
with:
21+
ref: ${{ github.head_ref }}
22+
- name: Set up Node
23+
uses: actions/setup-node@v4
24+
with:
25+
node-version-file: 'package.json'
26+
cache: 'yarn'
27+
28+
- name: Install dependencies
29+
run: yarn install --frozen-lockfile
30+
31+
- name: Add external contributor to CHANGELOG.md
32+
uses: ./dev-packages/external-contributor-gh-action
33+
with:
34+
name: ${{ github.event.pull_request.user.login }}
35+
- name: Create PR with changes
36+
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c
37+
with:
38+
commit-message: "ref: Add external contributor to CHANGELOG.md"
39+
title: "ref: Add external contributor to CHANGELOG.md"
40+
branch: 'external-contributor/patch-${{ github.event.pull_request.user.login }}'
41+
base: 'develop'
42+
delete-branch: true
43+
body: This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution.
44+

0 commit comments

Comments
 (0)