Auto-update Syft Version #43
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |