Skip to content

Commit 4fa97f7

Browse files
grubmeshiCopilot
andcommitted
ci: add update-module-refs workflow
Runs the Go tool on pushes to main (commits ref updates) and in dry-run mode on PRs. Uses actions/setup-go with go.mod version and sum-based caching. Full git history is fetched for SHA resolution. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 89e8ba9 commit 4fa97f7

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: update-module-refs
2+
3+
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'modules/**'
8+
pull_request:
9+
branches: [main]
10+
paths:
11+
- 'modules/**'
12+
13+
permissions:
14+
contents: write
15+
16+
jobs:
17+
update-module-refs:
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
with:
22+
# Full history needed for git log to resolve commit SHAs
23+
fetch-depth: 0
24+
# On push to main, use a token that can push commits
25+
token: ${{ github.event_name == 'push' && secrets.GITHUB_TOKEN || github.token }}
26+
27+
- uses: actions/setup-go@v5
28+
with:
29+
go-version-file: tools/update-module-refs/go.mod
30+
cache-dependency-path: tools/update-module-refs/go.sum
31+
32+
- name: Build
33+
working-directory: tools/update-module-refs
34+
run: go build -o update-module-refs .
35+
36+
- name: Update module refs (dry-run)
37+
if: github.event_name == 'pull_request'
38+
working-directory: modules
39+
run: ../tools/update-module-refs/update-module-refs -dry-run
40+
41+
- name: Update module refs
42+
if: github.event_name == 'push'
43+
working-directory: modules
44+
run: |
45+
git config user.name "github-actions[bot]"
46+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
47+
../tools/update-module-refs/update-module-refs
48+
49+
- name: Push ref updates
50+
if: github.event_name == 'push'
51+
run: git push

0 commit comments

Comments
 (0)