1111 runs-on : ubuntu-latest
1212 permissions :
1313 contents : write
14+ pull-requests : write
1415 steps :
1516 - name : Checkout repo
1617 uses : actions/checkout@v5
@@ -36,13 +37,15 @@ jobs:
3637 echo "Found previous tag: $prev_tag"
3738 echo "Replacing $prev_tag -> $new_tag"
3839
39- find .tekton -type f -name "*.yaml" -print0 | xargs -0 -I{} perl -0777 -i -pe "s/\Q$prev_tag\E/\Q $new_tag\E /g" "{}"
40+ find .tekton -type f -name "*.yaml" -print0 | xargs -0 -I{} perl -0777 -i -pe "s/\Q$prev_tag\E/$new_tag/g" "{}"
4041
4142 # Export previous tag for later steps
4243 echo "previous_tag=$prev_tag" >> $GITHUB_OUTPUT
4344
44- - name : Commit and push changes
45+ - name : Commit and push changes to branch
46+ id : commit
4547 run : |
48+ branch="update-tekton-tag-${{ github.event.inputs.new_tag }}"
4649 prev_tag="${{ steps.replace.outputs.previous_tag }}"
4750 new_tag="${{ github.event.inputs.new_tag }}"
4851
5457 exit 0
5558 fi
5659
60+ git checkout -b "$branch"
5761 git add .tekton/*.yaml
5862 git commit -m "chore: update tekton tag from ${prev_tag} to ${new_tag}"
59- git push origin main
63+ git push origin "$branch"
64+ echo "branch=$branch" >> $GITHUB_OUTPUT
65+
66+ - name : Create Pull Request
67+ run : |
68+ branch="${{ steps.commit.outputs.branch }}"
69+ prev_tag="${{ steps.replace.outputs.previous_tag }}"
70+ new_tag="${{ github.event.inputs.new_tag }}"
71+
72+ body=":rocket: Automated Tekton Image tag update.
73+ - Updated from \`${prev_tag}\` → \`${new_tag}\`
74+ - Created by \`.github/workflows/update-tekton-tags.yaml\`"
75+
76+ gh pr create \
77+ --repo "$GITHUB_REPOSITORY" \
78+ --title "chore: update Tekton Image tag ${prev_tag} → ${new_tag}" \
79+ --body "$body" \
80+ --head "$branch" \
81+ --base main
82+ env :
83+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments