-
Notifications
You must be signed in to change notification settings - Fork 4
62 lines (53 loc) · 2.17 KB
/
Copy pathautoapprove.yml
File metadata and controls
62 lines (53 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
# This workflow auto approves the PR generated by the bump_version
# workflow, and moves the tag that was created in the PR's branch
# to develop.
name: github-actions auto-approve
on: pull_request_target
permissions:
pull-requests: write
contents: write
jobs:
approve-bot:
runs-on: ubuntu-latest
if: ${{ github.event.pull_request.user.login == 'semgrep-ci[bot]'}}
steps:
- name: Approve
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Watch untill PR checks are done
run: gh pr checks --required --watch "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Merge PR
run: gh pr merge --squash "$PR_URL"
env:
PR_URL: ${{ github.event.pull_request.html_url }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Now we switch to semgrep-ci[bot] to actually be able to
# move the tag we created in bump_version.yml from the
# release branch to develop
- id: token
name: Get token for semgrep-ci GitHub App
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ secrets.SEMGREP_CI_CLIENT_ID }}
private-key: ${{ secrets.SEMGREP_CI_APP_KEY }}
owner: ${{ github.repository_owner }}
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
with:
ref: develop
token: ${{ steps.token.outputs.token }}
- name: Move tag to develop branch
env:
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
run: |
CURR_VERSION=$(grep -o 'version=\"[0-9.]*\"' setup.py | sed "s/version=\"\([0-9.]*\)\"/\1/")
# We tagged the release branch first in bump_version.yml
# to allow tests to pass; now moving it to develop so
# it can be a part of its history
git push --delete origin "v${CURR_VERSION}"
git tag "v${CURR_VERSION}" HEAD
git push origin tag "v${CURR_VERSION}"