Compile versions #1369
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: 'Compile versions' | |
on: | |
schedule: | |
- cron: '0 */12 * * *' | |
workflow_dispatch: | |
concurrency: | |
group: '${{ github.workflow }}-${{ github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
env: | |
PR_BRANCH: 'actions/gcloud-versions' | |
jobs: | |
compile-versions: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- name: 'Checkout' | |
uses: 'actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29' # ratchet:actions/checkout@v4 | |
- name: 'Setup Go' | |
uses: 'actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7' # ratchet:actions/setup-go@v5 | |
with: | |
go-version-file: 'go.mod' | |
- name: 'Get versions list' | |
run: |- | |
mkdir -p ./data | |
go run ./cmd/compile-versions/main.go > ./data/versions.json | |
echo "Computed versions:" | |
cat ./data/versions.json | |
- id: 'updates' | |
name: 'Update versions list' | |
run: |- | |
if git diff --exit-code ./data/versions.json; then | |
echo "No changes" | |
echo "had_changes=false" >> ${GITHUB_OUTPUT} | |
exit 0 | |
fi | |
echo "had_changes=true" >> ${GITHUB_OUTPUT} | |
# Create a pull request with updated files | |
- name: 'Create/Update Pull Request' | |
# Skip if there a no changes | |
if: '${{ fromJSON(steps.updates.outputs.had_changes) }}' | |
uses: 'abcxyz/pkg/.github/actions/create-pull-request@45258f93afbaca705ef0503c37ef88451ed45b02' # ratchet:abcxyz/pkg/.github/actions/create-pull-request@main | |
with: | |
token: '${{ secrets.ACTIONS_BOT_TOKEN }}' | |
base_branch: '${{ github.event.repository.default_branch }}' | |
head_branch: '${{ env.PR_BRANCH }}' | |
title: 'Update gcloud versions' | |
body: 'Update latest gcloud versions' | |
changed_paths: |- | |
[ | |
"data/versions.json" | |
] |