2023-05-15 07:06:15 +00:00
|
|
|
name: "Update dependencies"
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
# Monday, 10AM UTC
|
|
|
|
- cron: "0 10 * * 1"
|
|
|
|
|
|
|
|
workflow_dispatch:
|
|
|
|
inputs: {}
|
|
|
|
|
|
|
|
|
2024-01-18 20:03:07 +00:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2023-05-15 07:06:15 +00:00
|
|
|
jobs:
|
|
|
|
branches:
|
|
|
|
name: get branch data
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
outputs:
|
|
|
|
branches: ${{ steps.branches.outputs.branches }}
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- name: Checkout
|
2024-10-15 07:37:11 +00:00
|
|
|
uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
2023-05-15 07:06:15 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
ref: ${{ github.event.inputs.ref }}
|
|
|
|
- name: set branches output
|
|
|
|
id: branches
|
2023-08-02 19:42:03 +00:00
|
|
|
# outputs the second to most recent `release-x.y` branches plus `main` as JSON
|
2023-05-15 07:06:15 +00:00
|
|
|
run: |
|
2023-08-02 19:42:03 +00:00
|
|
|
echo "branches=$(git branch -a | grep -E "remotes/origin/(main|release-)" | sed 's/ remotes\/origin\///' | sort -V | tail -2 | head -1 | jq -R -s -c 'split("\n") | map(select(length > 0)) | . + ["main"]')" >> $GITHUB_OUTPUT
|
2023-05-15 07:06:15 +00:00
|
|
|
|
|
|
|
update-dependencies:
|
2024-01-18 20:03:07 +00:00
|
|
|
permissions:
|
|
|
|
contents: write # for Git to git push
|
2023-05-15 07:06:15 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
needs: branches
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
branch: ${{ fromJson(needs.branches.outputs.branches) }}
|
|
|
|
steps:
|
|
|
|
- name: Setup Go
|
2024-07-15 10:43:35 +00:00
|
|
|
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
|
2023-05-15 07:06:15 +00:00
|
|
|
with:
|
2023-10-20 00:28:14 +00:00
|
|
|
go-version: "1.21"
|
2023-05-15 07:06:15 +00:00
|
|
|
|
|
|
|
# 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
|
2024-01-18 20:03:07 +00:00
|
|
|
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a # v2.1.0
|
2023-05-15 07:06:15 +00:00
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.APP_ID }}
|
|
|
|
private_key: ${{ secrets.PRIVATE_KEY }}
|
2024-10-15 07:37:11 +00:00
|
|
|
- uses: actions/checkout@eef61447b9ff4aafe5dcd4e0bbf5d482be7e7871 # v4.2.1
|
2023-05-15 07:06:15 +00:00
|
|
|
with:
|
|
|
|
token: ${{ steps.generate_token.outputs.token }}
|
|
|
|
ref: ${{ matrix.branch }}
|
|
|
|
fetch-depth: 0
|
|
|
|
- name: create pull request
|
|
|
|
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
|
|
|
|
|
|
|
|
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 ${{ matrix.branch }} -H ${BRANCH} --title 'chore: update dependencies' --body 'Update dependencies'
|
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
|