Skip to content

Commit 01e2ece

Browse files
committed
ci: rework dependabot_pr workflow to amend commit
Signed-off-by: Otavio Salvador <[email protected]>
1 parent 251e3ee commit 01e2ece

File tree

2 files changed

+16
-40
lines changed

2 files changed

+16
-40
lines changed

.github/workflows/dependabot_pr.yml

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,39 @@
11
name: dependabot_pr
22

33
on:
4-
pull_request:
4+
pull_request_target:
55
branches: [master]
66
paths:
77
- '**/go.mod'
88
- '**/go.sum'
99

1010
jobs:
1111
go-mod-tidy:
12+
name: Update Go modules
1213
if: contains(github.head_ref, 'dependabot/go_modules/') && github.event.pull_request.user.login == 'dependabot[bot]'
1314
runs-on: ubuntu-latest
1415
steps:
1516
- uses: actions/checkout@v3
1617
with:
17-
ref: ${{ github.event.pull_request.head.sha }}
18+
ref: ${{ github.head_ref }}
19+
fetch-depth: 2
20+
token: ${{ secrets.PAT }}
1821
- uses: actions/setup-go@v3
1922
with:
2023
go-version: 1.17
2124
- name: Run prepare-release script to update Go modules
2225
run: |
2326
./devscripts/prepare-release
24-
- name: Create diff artifact
27+
- name: Get last commit message
28+
id: last-commit-message
2529
run: |
26-
git diff > /tmp/diff
27-
- uses: actions/upload-artifact@v2
30+
echo "msg=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
31+
- name: Commit changes
32+
uses: stefanzweifel/git-auto-commit-action@v4
2833
with:
29-
name: diff
30-
path: /tmp/diff
31-
retention-days: 1
34+
branch: ${{ github.event.workflow_run.head_branch }}
35+
file_pattern: '**/go.mod **/go.sum'
36+
commit_message: ${{ steps.last-commit-message.outputs.msg }}
37+
commit_options: '--amend --no-edit'
38+
push_options: '--force'
39+
skip_fetch: true

.github/workflows/dependabot_pr_gomodtidify.yml

-32
This file was deleted.

0 commit comments

Comments
 (0)