Skip to content

Commit 60408ba

Browse files
committed
fixup! chore(ci): add conflict resolver to Update Nock file workflow
1 parent 2f796d3 commit 60408ba

File tree

1 file changed

+13
-9
lines changed

1 file changed

+13
-9
lines changed

.github/workflows/update-nock-files.yml

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,16 @@ jobs:
3434
if: ${{ !inputs.head_sha }}
3535
run: |
3636
set -x
37-
[ "$(gh pr view "$GITHUB_SERVER/$GITHUB_REPOSITORY/pull/$PR_ID" \
38-
--json headRepositoryOwner --jq '.headRepositoryOwner.name') = "$GITHUB_REPOSITORY_OWNER" ]
37+
[ "$(gh pr view "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/$PR_ID" \
38+
--json headRepositoryOwner --jq '.headRepositoryOwner.name')" = "$GITHUB_REPOSITORY_OWNER" ]
3939
env:
4040
PR_ID: ${{ inputs.pr_id }}
4141
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4242

4343
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
4444
with:
45-
ref: refs/pulls/${{ inputs.pr_id }}/head
45+
ref: refs/pull/${{ inputs.pr_id }}/head
46+
fetch-depth: ${{ !inputs.fix_conflicts && 1 || 0 }}
4647

4748
- name: Verify if provided SHA matches PR head
4849
if: ${{ inputs.head_sha }}
@@ -52,16 +53,19 @@ jobs:
5253
env:
5354
EXPECTED: ${{ inputs.head_sha }}
5455

55-
- name: Git config
56+
- name: Setup git author
5657
run: |
57-
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
58-
git config --global user.name "github-actions[bot]"
58+
git config --local user.email "github-bot@iojs.org"
59+
git config --local user.name "Node.js GitHub Bot"
5960
6061
- name: Merge base branch
6162
if: ${{ inputs.fix_conflicts }}
6263
run: |
63-
git fetch "$GITHUB_SERVER/$GITHUB_REPOSITORY.git" HEAD
64-
git merge FETCH_HEAD --no-edit -s ours
64+
set -x
65+
git merge "origin/$(gh pr view "$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/pull/$PR_ID" --json baseRefName --jq '.baseRefName')" --no-edit -X theirs
66+
env:
67+
PR_ID: ${{ inputs.pr_id }}
68+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6569

6670
- name: Install Node
6771
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
@@ -110,7 +114,7 @@ jobs:
110114
111115
- name: Push changes
112116
if: ${{ steps.contains-changes.outputs.result == 'yes' || inputs.fix_conflicts }}
113-
run: git push
117+
run: git push origin HEAD:refs/pull/${{ inputs.pr_id }}/head
114118

115119
- name: Upload `tests/nocks.db` in case of failure
116120
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2

0 commit comments

Comments
 (0)