Skip to content

Commit a90ba73

Browse files
authored
ci(gitflow): Use personal access token to create PR (#7026)
Otherwise, workflows will not be triggered due to security issues. See peter-evans/create-pull-request#48 for details.
1 parent 236b173 commit a90ba73

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

.github/workflows/gitflow-sync-develop.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ on:
1212

1313
env:
1414
SOURCE_BRANCH: master
15-
TAGRET_BRANCH: develop
15+
TARGET_BRANCH: develop
1616

1717
jobs:
1818
main:
@@ -35,6 +35,8 @@ jobs:
3535
pr_title: '[Gitflow] Merge ${{ env.SOURCE_BRANCH }} into ${{ env.TARGET_BRANCH }}'
3636
pr_body: 'Merge ${{ env.SOURCE_BRANCH }} branch into ${{ env.TARGET_BRANCH }}'
3737
pr_label: 'Dev: Gitflow'
38+
# This token is scoped to Daniel Griesser
39+
github_token: ${{ secrets.REPO_SCOPED_TOKEN }}
3840

3941
# https://github.com/marketplace/actions/enable-pull-request-automerge
4042
- name: Enable automerge for PR
@@ -47,10 +49,8 @@ jobs:
4749
# https://github.com/marketplace/actions/auto-approve
4850
- name: Auto approve PR
4951
# Always skip this for now, until we got a proper bot setup
50-
if: steps.open-pr.outputs.pr_number != '' || 1 == 2
52+
if: steps.open-pr.outputs.pr_number != ''
5153
uses: hmarr/auto-approve-action@v3
5254
with:
5355
pull-request-number: ${{ steps.open-pr.outputs.pr_number }}
5456
review-message: 'Auto approved automated PR'
55-
# TODO: Use the token of some user here??
56-
# github-token: ${{ secrets.SOME_USERS_PAT }}

.github/workflows/gitflow-sync-master.yml

+12-3
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ jobs:
3232
pr_title: '[Gitflow] Merge ${{ github.ref_name }} into ${{ env.MAIN_BRANCH }}'
3333
pr_body: 'Merge ${{ github.ref_name }} branch into ${{ env.MAIN_BRANCH }}'
3434
pr_label: 'Dev: Gitflow'
35+
# This token is scoped to Daniel Griesser
36+
github_token: ${{ secrets.REPO_SCOPED_TOKEN }}
3537

3638
# https://github.com/marketplace/actions/enable-pull-request-automerge
3739
- name: Enable automerge for PR
@@ -44,10 +46,17 @@ jobs:
4446
# https://github.com/marketplace/actions/auto-approve
4547
- name: Auto approve PR
4648
# Always skip this for now, until we got a proper bot setup
47-
if: steps.open-pr.outputs.pr_number != '' || 1 == 2
49+
if: steps.open-pr.outputs.pr_number != ''
4850
uses: hmarr/auto-approve-action@v3
4951
with:
5052
pull-request-number: ${{ steps.open-pr.outputs.pr_number }}
5153
review-message: 'Auto approved automated PR'
52-
# TODO: Use the token of some user here??
53-
# github-token: ${{ secrets.SOME_USERS_PAT }}
54+
55+
skipped:
56+
runs-on: ubuntu-20.04
57+
if: |
58+
github.event.pull_request.merged == false
59+
|| startsWith(github.event.pull_request.title, "meta(changelog):") == false
60+
steps:
61+
- name: Sync skipped
62+
run: echo "OK"

0 commit comments

Comments
 (0)