Skip to content

Commit

Permalink
ci(gitflow): Use personal access token to create PR (getsentry#7026)
Browse files Browse the repository at this point in the history
Otherwise, workflows will not be triggered due to security issues.
See peter-evans/create-pull-request#48 for details.
  • Loading branch information
mydea authored Feb 1, 2023
1 parent 236b173 commit a90ba73
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/gitflow-sync-develop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:

env:
SOURCE_BRANCH: master
TAGRET_BRANCH: develop
TARGET_BRANCH: develop

jobs:
main:
Expand All @@ -35,6 +35,8 @@ jobs:
pr_title: '[Gitflow] Merge ${{ env.SOURCE_BRANCH }} into ${{ env.TARGET_BRANCH }}'
pr_body: 'Merge ${{ env.SOURCE_BRANCH }} branch into ${{ env.TARGET_BRANCH }}'
pr_label: 'Dev: Gitflow'
# This token is scoped to Daniel Griesser
github_token: ${{ secrets.REPO_SCOPED_TOKEN }}

# https://github.com/marketplace/actions/enable-pull-request-automerge
- name: Enable automerge for PR
Expand All @@ -47,10 +49,8 @@ jobs:
# https://github.com/marketplace/actions/auto-approve
- name: Auto approve PR
# Always skip this for now, until we got a proper bot setup
if: steps.open-pr.outputs.pr_number != '' || 1 == 2
if: steps.open-pr.outputs.pr_number != ''
uses: hmarr/auto-approve-action@v3
with:
pull-request-number: ${{ steps.open-pr.outputs.pr_number }}
review-message: 'Auto approved automated PR'
# TODO: Use the token of some user here??
# github-token: ${{ secrets.SOME_USERS_PAT }}
15 changes: 12 additions & 3 deletions .github/workflows/gitflow-sync-master.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ jobs:
pr_title: '[Gitflow] Merge ${{ github.ref_name }} into ${{ env.MAIN_BRANCH }}'
pr_body: 'Merge ${{ github.ref_name }} branch into ${{ env.MAIN_BRANCH }}'
pr_label: 'Dev: Gitflow'
# This token is scoped to Daniel Griesser
github_token: ${{ secrets.REPO_SCOPED_TOKEN }}

# https://github.com/marketplace/actions/enable-pull-request-automerge
- name: Enable automerge for PR
Expand All @@ -44,10 +46,17 @@ jobs:
# https://github.com/marketplace/actions/auto-approve
- name: Auto approve PR
# Always skip this for now, until we got a proper bot setup
if: steps.open-pr.outputs.pr_number != '' || 1 == 2
if: steps.open-pr.outputs.pr_number != ''
uses: hmarr/auto-approve-action@v3
with:
pull-request-number: ${{ steps.open-pr.outputs.pr_number }}
review-message: 'Auto approved automated PR'
# TODO: Use the token of some user here??
# github-token: ${{ secrets.SOME_USERS_PAT }}

skipped:
runs-on: ubuntu-20.04
if: |
github.event.pull_request.merged == false
|| startsWith(github.event.pull_request.title, "meta(changelog):") == false
steps:
- name: Sync skipped
run: echo "OK"

0 comments on commit a90ba73

Please sign in to comment.