Sync from fork #165
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: Sync from fork | |
on: | |
schedule: | |
- cron: '0 8 */7 * *' # At 08:00 on every 7th day-of-month | |
# Allows to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
env: | |
fork_repo: https://github.com/giantswarm/trivy-operator-upstream | |
branch: 'main#update-chart' | |
jobs: | |
sync-app-trivy-operator-with-fork: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- run: | | |
# Get the last tag from fork repo | |
LAST_TAG=$(git ls-remote --tags --sort='v:refname' --refs $fork_repo \ | |
| tail -1 | cut -d '/' -f3) | |
echo "Last tag found is $LAST_TAG" | |
# Setup git config | |
git config user.name "shield-automation[bot]" | |
git config user.email "294496+shield-automation[bot]@users.noreply.github.com" | |
git checkout -b $branch | |
# Modify the version in Vendir config | |
sed -i -r "s/(ref:).*/\1 $LAST_TAG/g" vendir.yml | |
git add vendir.yml | |
git commit -m "Update app version from fork repo" | |
git push origin $branch | |
call-update-chart: | |
uses: ./.github/workflows/zz_generated.update_chart.yaml | |
needs: sync-app-trivy-operator-with-fork | |
with: | |
branch: 'main#update-chart' | |
secrets: inherit |