Skip to content

Commit e845ff0

Browse files
Ep use gh for cmd backport (#58)
* use gh+git for the backport creation * use gh auth * make git setup * try with another token generation action * test token * add extra permissions to token * debug token setup * Do checkout with the generated token * try to generate token with official gha * cleanup
1 parent 4d3354f commit e845ff0

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

.github/workflows/command-backport.yml

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ jobs:
1818
env:
1919
GH_TOKEN: ${{ github.token }}
2020
outputs:
21-
LABELS: ${{ steps.check_labels.outputs.LABELS}}
22-
found: ${{ steps.check_labels.outputs.found}}
21+
LABELS: ${{ steps.check_labels.outputs.LABELS }}
22+
found: ${{ steps.check_labels.outputs.found }}
2323

2424
# The 'github.event.pull_request.merged' ensures that it got into master:
2525
if: >
@@ -45,14 +45,24 @@ jobs:
4545
echo "found=false" >> $GITHUB_OUTPUT
4646
fi
4747
48-
4948
backport:
5049
name: Backport pull request
5150
runs-on: ubuntu-latest
52-
needs: [ check-labels ]
53-
if: ${{ needs.check-labels.outputs.found == 'true' }}
51+
needs: [check-labels]
52+
if: ${{ needs.check-labels.outputs.found == 'true' }}
5453
steps:
55-
- uses: actions/checkout@v4
54+
55+
- name: Generate token
56+
id: generate_token
57+
uses: actions/create-github-app-token@v1
58+
with:
59+
app-id: ${{ secrets.RELEASE_BACKPORT_AUTOMATION_APP_ID }}
60+
private-key: ${{ secrets.RELEASE_BACKPORT_AUTOMATION_APP_PRIVATE_KEY }}
61+
62+
- name: Checkout sources
63+
uses: actions/checkout@v4
64+
with:
65+
token: ${{ steps.generate_token.outputs.token }}
5666

5767
- name: Get branches to backport to
5868
id: branches
@@ -63,12 +73,6 @@ jobs:
6373
BACKPORT_BRANCHES=$(parse_branch_names_from_backport_labels "$LABELS")
6474
echo "BACKPORT_BRANCHES=${BACKPORT_BRANCHES}" >> $GITHUB_OUTPUT
6575
66-
- name: Generate token
67-
id: generate_token
68-
uses: actions/create-github-app-token@v1
69-
with:
70-
app-id: ${{ secrets.RELEASE_BACKPORT_AUTOMATION_APP_ID }}
71-
private-key: ${{ secrets.RELEASE_BACKPORT_AUTOMATION_APP_PRIVATE_KEY }}
7276
7377
- name: Create backport pull requests
7478
uses: korthout/backport-action@v3

0 commit comments

Comments
 (0)