Skip to content

Commit f962ce6

Browse files
authored
ci: create workflow to automatically update snapshots (google#4308)
This is based off the robot in `osv-scanner`
1 parent b0ee12c commit f962ce6

1 file changed

Lines changed: 46 additions & 0 deletions

File tree

.github/workflows/snapshots.yml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Snapshots
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: go test ./...
32+
working-directory: tools/apitester
33+
env:
34+
OSV_API_BASE_URL: api.test.osv.dev
35+
UPDATE_SNAPS: always
36+
- uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
37+
with:
38+
token: ${{ secrets.PR_TOKEN_BOT }}
39+
title: "test: update snapshots"
40+
body: >
41+
The snapshots have changed, probably due to OSV advisories being changed.
42+
43+
Please review the differences to make sure that they're expected!
44+
branch: "bot/update-snapshots"
45+
author: "osv-robot <osv-robot@google.com>"
46+
commit-message: "test: update snapshots"

0 commit comments

Comments
 (0)