99 - cron : ' 0 0 * * *'
1010
1111jobs :
12- build_images :
12+ self_upgrade :
1313 runs-on : ubuntu-latest
1414
1515 permissions :
1616 contents : write
1717 pull-requests : write
18+
19+ env :
20+ SOURCE_BRANCH : " ${{ github.ref_name }}"
21+ SELF_UPGRADE_BRANCH : " self-upgrade-${{ github.ref_name }}"
1822
1923 steps :
20- - name : Fail if branch is not main
21- if : github.ref != 'refs/heads/main'
24+ - name : Fail if branch is not head of branch.
25+ if : ${{ !startsWith( github.ref, 'refs/heads/') && env.SOURCE_BRANCH != '' && env.SELF_UPGRADE_BRANCH != '' }}
2226 run : |
23- echo "This workflow should not be run on a branch other than main ."
27+ echo "This workflow should not be run on a non- branch-head ."
2428 exit 1
2529
2630 - uses : actions/checkout@v4
3438 go-version : ${{ steps.go-version.outputs.result }}
3539
3640 - run : |
37- git checkout -B "self-upgrade "
41+ git checkout -B "$SELF_UPGRADE_BRANCH "
3842
3943 - run : |
4044 make -j upgrade-klone
@@ -54,10 +58,10 @@ jobs:
5458
5559 - if : ${{ steps.is-up-to-date.outputs.result != 'true' }}
5660 run : |
57- git config --global user.name "jetstack -bot"
58- git config --global user.email "jetstack [email protected] " 61+ git config --global user.name "cert-manager -bot"
62+ git config --global user.email "cert-manager [email protected] " 5963 git add -A && git commit -m "BOT: run 'make upgrade-klone' and 'make generate'" --signoff
60- git push -f origin self-upgrade
64+ git push -f origin "$SELF_UPGRADE_BRANCH"
6165
6266 - if : ${{ steps.is-up-to-date.outputs.result != 'true' }}
6367 uses : actions/github-script@v7
@@ -67,18 +71,18 @@ jobs:
6771 const pulls = await github.rest.pulls.list({
6872 owner: owner,
6973 repo: repo,
70- head: owner + ':self-upgrade' ,
71- base: 'main' ,
74+ head: owner + ':' + process.env.SELF_UPGRADE_BRANCH ,
75+ base: process.env.SOURCE_BRANCH ,
7276 state: 'open',
7377 });
7478
7579 if (pulls.data.length < 1) {
7680 await github.rest.pulls.create({
77- title: '[CI] Merge self-upgrade into main' ,
81+ title: '[CI] Merge ' + process.env.SELF_UPGRADE_BRANCH + ' into ' + process.env.SOURCE_BRANCH ,
7882 owner: owner,
7983 repo: repo,
80- head: 'self-upgrade' ,
81- base: 'main' ,
84+ head: process.env.SELF_UPGRADE_BRANCH ,
85+ base: process.env.SOURCE_BRANCH ,
8286 body: [
8387 'This PR is auto-generated to bump the Makefile modules.',
8488 ].join('\n'),
0 commit comments