Skip to content

Commit de3fd42

Browse files
authored
ci: introduce dedicated workflow for updating osv-scalibr (#2246)
Having renovate do this isn't currently working out as it doesn't support always updating a Go module to the latest digest so whenever a new version of `osv-scalibr` is published we have to manually update to the next pseudo version, so this introduces a new workflow similar to the one we use for updating the snapshots except for updating to the latest commit on `main` for `osv-scalibr`. Currently I've just got this running on the same schedule as the snapshots workflow, though in theory we should be able to wire this up to `osv-scalibr` to have it actually trigger the workflow whenever a change is merged in 🤯
1 parent e40bcbd commit de3fd42

File tree

2 files changed

+52
-1
lines changed

2 files changed

+52
-1
lines changed

.github/workflows/dependencies.yml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Dependencies
2+
3+
on:
4+
schedule:
5+
- cron: "47 18 * * *"
6+
workflow_dispatch:
7+
concurrency:
8+
# Pushing new changes to a branch will cancel any in-progress CI runs
9+
group: ${{ github.workflow }}-${{ github.ref }}
10+
cancel-in-progress: true
11+
12+
# Restrict jobs in this workflow to have no permissions by default; permissions
13+
# should be granted per job as needed using a dedicated `permissions` block
14+
permissions: {}
15+
16+
jobs:
17+
update:
18+
permissions:
19+
contents: write # to fetch and commit code
20+
actions: write # to manually dispatch checks on the pull request
21+
pull-requests: write # Create pull requests
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
25+
with:
26+
persist-credentials: false
27+
- uses: actions/setup-go@44694675825211faa026b3c33043df3e48a5fa00 # v6.0.0
28+
with:
29+
go-version: stable
30+
check-latest: true
31+
- run: |
32+
latest_commit=$(git ls-remote https://github.com/google/osv-scalibr.git HEAD | cut -f1)
33+
echo "updating osv-scalibr to $latest_commit"
34+
go get github.com/google/osv-scalibr@"$latest_commit"
35+
echo "latest_scalibr_commit=$latest_commit" >> "$GITHUB_ENV"
36+
go mod tidy
37+
- run: go test ./cmd/osv-scanner/ -run 'Test_run$'
38+
env:
39+
TEST_ACCEPTANCE: true
40+
UPDATE_SNAPS: always
41+
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
42+
with:
43+
token: ${{ secrets.PR_TOKEN_BOT }}
44+
title: "feat: update osv-scalibr"
45+
body: >
46+
This updates `osv-scalibr` to https://github.com/google/osv-scalibr/commit/${{ env.latest_scalibr_commit }}
47+
branch: "bot/update-scalibr"
48+
author: "osv-robot <[email protected]>"
49+
commit-message: "feat: update osv-scalibr to ${{ env.latest_scalibr_commit }}"
50+
delete-branch: true

renovate.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,8 @@
2424
},
2525
{
2626
"matchPackageNames": ["github.com/google/osv-scalibr"],
27-
"groupName": "osv-scalibr"
27+
"groupName": "osv-scalibr",
28+
"enabled": false
2829
}
2930
],
3031
"ignorePaths": ["**/testdata/**"],

0 commit comments

Comments
 (0)