-
Notifications
You must be signed in to change notification settings - Fork 1
49 lines (45 loc) · 1.85 KB
/
syft-update-autocheck.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
name: Auto-update Syft Version
on:
workflow_dispatch:
schedule:
- cron: '0 10 * * 1'
# pull_request_target:
# branches: [ main ]
jobs:
update-dep:
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
steps:
- uses: actions/checkout@v4
- name: Check and update Syft version
id: check-syft
run: |
old_version="$(grep -Po '(?<=SYFT_VERSION )\d+(\.\d+)+' syft_version.cmake)"
echo "Old version: $old_version"
echo "old_version=$old_version" >> $GITHUB_OUTPUT
new_version=$(git -c 'versionsort.suffix=-' \
ls-remote --exit-code --refs --sort='version:refname' --tags https://github.com/anchore/syft/ 'v*.*.*'\
| tail --lines=1\
| cut --delimiter='/' --fields=3\
| grep -Po '\d+(\.\d+)+')
echo "New version: $new_version"
echo "new_version=$new_version" >> $GITHUB_OUTPUT
if [ "$old_version" != "$new_version" ]; then
echo "set(SYFT_VERSION $new_version)" > syft_version.cmake
echo "syft version updated"
else
echo "No change in syft version"
fi
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: Update syft dependencies
title: Update Syft version (${{ steps.check-syft.outputs.new_version }})
body: |
- Update Syft version to ${{ steps.check-syft.outputs.new_version }}
Auto-generated by ${{ github.server_url }}/${{ github.repository }}/runs/${{ github.job }}?check_suite_focus=true
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
branch: syft-version-update/${{ steps.check-syft.outputs.new_version }}