|
| 1 | +--- |
| 2 | +name: Update Tag References |
| 3 | +permissions: |
| 4 | + contents: write |
| 5 | + pull-requests: write |
| 6 | +concurrency: |
| 7 | + group: update-tag-pins-${{ github.ref_name }} |
| 8 | + cancel-in-progress: true |
| 9 | +on: # yamllint disable-line rule:truthy |
| 10 | + push: |
| 11 | + tags: |
| 12 | + - 'v*' |
| 13 | + |
| 14 | +jobs: |
| 15 | + patch-references: |
| 16 | + runs-on: ubuntu-latest |
| 17 | + steps: |
| 18 | + - name: Checkout release tag |
| 19 | + uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + ref: ${{ github.ref_name }} |
| 22 | + fetch-depth: 0 |
| 23 | + |
| 24 | + - name: Bump openstack-k8s-operators/gitops ?ref= pin URLs |
| 25 | + env: |
| 26 | + NEW_TAG: ${{ github.ref_name }} |
| 27 | + run: | |
| 28 | + set -euo pipefail |
| 29 | + # Only ?ref= on this repo's GitHub URLs (not tree/blob links, not |
| 30 | + # other hosts, not commit hashes — only vMAJOR.MINOR.PATCH). Literal |
| 31 | + # TAG/BRANCH placeholders and feature-branch refs are unchanged. |
| 32 | + VER='v[0-9]+\.[0-9]+\.[0-9]+' |
| 33 | + REF_RE="(github\\.com/openstack-k8s-operators/gitops[^[:space:]?)\"']*\\?ref=)${VER}" |
| 34 | + while IFS= read -r -d '' f; do |
| 35 | + sed -i -E -e "s|${REF_RE}|\\1${NEW_TAG}|g" "$f" |
| 36 | + done < <(find . -type f \( -name '*.md' -o -name '*.yaml' -o -name '*.yml' \) \ |
| 37 | + ! -path './.git/*' -print0) |
| 38 | +
|
| 39 | + - name: Create pull request |
| 40 | + uses: peter-evans/create-pull-request@v8.1.1 |
| 41 | + with: |
| 42 | + branch: chore/update-tag-pins-${{ github.ref_name }} |
| 43 | + base: main |
| 44 | + commit-message: 'docs: update gitops pin references to ${{ github.ref_name }}' |
| 45 | + title: 'docs: update gitops ?ref= pins for ${{ github.ref_name }}' |
| 46 | + body: | |
| 47 | + Automated update: set `?ref=` URLs for `github.com/openstack-k8s-operators/gitops` |
| 48 | + to **${{ github.ref_name }}** after that tag was pushed. |
| 49 | +
|
| 50 | + Please review and merge when checks pass. |
0 commit comments