update image digests #266
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: update image digests | |
on: | |
schedule: | |
- cron: 0 1 * * * | |
workflow_dispatch: {} | |
permissions: | |
contents: write | |
pull-requests: write | |
issues: write | |
checks: write | |
jobs: | |
update-image-digests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3 | |
- uses: GeoNet/setup-crane@00c9e93efa4e1138c9a7a5c594acd6c75a2fbf0c # main | |
- name: configure system | |
run: | | |
git config user.name 'geonetci' | |
git config user.email '[email protected]' | |
gh auth login --with-token < <(echo ${{ secrets.GH_CI_USER_TOKEN }}) | |
gh auth status | |
- name: update select images | |
run: ./hack/update-sync-image-digests.sh | |
- name: determine changes | |
id: determine-changes | |
run: | | |
if git ls-files --others --modified --deleted --exclude-standard | grep -E 'config.yaml'; then | |
echo "changes=true" >> $GITHUB_OUTPUT | |
fi | |
- name: commit and push if there are changes | |
if: ${{ steps.determine-changes.outputs.changes == 'true' }} | |
env: | |
GH_TOKEN: ${{ secrets.GH_CI_USER_TOKEN }} | |
run: | | |
TIMESTAMP="$(git log -n1 --pretty='format:%cd' --date=format:'%Y-%m-%d-%H-%M')" | |
NEW_BRANCH="config-yaml-image-update-for-${TIMESTAMP}" | |
git add ./config.yaml | |
git branch "${NEW_BRANCH}" | |
git checkout "${NEW_BRANCH}" | |
git commit -s -m "chore: update sync config.yaml images for ${TIMESTAMP}" -m "updates sync config.yaml images for ${TIMESTAMP}" | |
git push origin "${NEW_BRANCH}" | |
if ! gh label list --json name --jq .[].name | grep -Eq '^image-digest-update$'; then | |
gh label create image-digest-update || true | |
fi | |
gh pr --label image-digest-update create --title "Update sync config.yaml images ${TIMESTAMP}" --reviewer GeoNet/platform-team --body "updates sync config.yaml images for ${TIMESTAMP}" |