| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- name: "Update dependencies"
- on:
- schedule:
- # Monday, 10AM UTC
- - cron: "0 10 * * 1"
- workflow_dispatch:
- inputs: {}
- permissions:
- contents: read
- jobs:
- branches:
- name: get branch data
- runs-on: ubuntu-latest
- outputs:
- branches: ${{ steps.branches.outputs.branches }}
- steps:
- - uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
- with:
- egress-policy: audit
- - name: Checkout
- uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- with:
- fetch-depth: 0
- ref: ${{ github.event.inputs.ref }}
- - name: set branches output
- id: branches
- run: echo "branches=[\"main\"]" >> $GITHUB_OUTPUT
- update-dependencies:
- permissions:
- contents: write # for Git to git push
- runs-on: ubuntu-latest
- needs: branches
- strategy:
- matrix:
- branch: ${{ fromJson(needs.branches.outputs.branches) }}
- steps:
- - uses: step-security/harden-runner@df199fb7be9f65074067a9eb93f12bb4c5547cf2 # v2.13.3
- with:
- egress-policy: audit
- # we can not use the default GHA token, as it prevents subsequent GHA
- # from running: we can create a PR but the tests won't run :/
- - name: Generate token
- id: generate_token
- uses: actions/create-github-app-token@29824e69f54612133e76f7eaac726eef6c875baf # v2.2.1
- with:
- app-id: ${{ secrets.APP_ID }}
- private-key: ${{ secrets.PRIVATE_KEY }}
- owner: ${{ github.repository_owner }}
- - uses: actions/checkout@8e8c483db84b4bee98b60c0593521ed34d9990e8 # v6.0.1
- with:
- token: ${{ steps.generate_token.outputs.token }}
- ref: ${{ matrix.branch }}
- fetch-depth: 0
- - name: Setup Go
- uses: actions/setup-go@4dc6199c7b1a012772edbd06daecab0f50c9053c # v6.1.0
- with:
- go-version-file: go.mod
- - name: create pull request
- env:
- BASE_BRANCH: ${{ matrix.branch }}
- GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
- run: |
- git config --global user.email "ExternalSecretsOperator@users.noreply.github.com"
- git config --global user.name "External Secrets Operator"
- BRANCH=update-deps-$(date "+%s")
- make update-deps || true
- make check-diff || true
- if git diff-index --quiet HEAD --; then
- echo "nothing changed. skipping."
- exit 0;
- fi
- git checkout -b $BRANCH
- git add -A
- git commit -m "update dependencies" -s
- git push origin $BRANCH
- gh pr create -B $BASE_BRANCH -H ${BRANCH} --title 'chore: update dependencies' --body 'Update dependencies'
|