Skip to content

Commit b7192c5

Browse files
yosefAlsuhaibaniYosef AlsuhaibaniAndre Kuhlenschmidtsemgrep-ci[bot]
authored
Sync frm test fork. (#24)
* Add work from other fork * Hardcode configs + remove inc * adding remotes command * going to version 2 of checkout * using version 4 of checkout * using with submodules: true * remove fake reviwer` * add gh token * aaa * Add autoapprove bot * Remove approvals and merge from bump_version * remove bogus reviewer * wack script * Fix bump ver * Restore state? * change name * fix typo * Bump setup to 1.82.0 * Bump pre-commit yaml to 1.81.0 (#16) Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> * Bump pre-commit yaml to 1.84.1 (#18) Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> * Bump setup to 1.33.22 (#19) Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> * simplify workflow * Make 2nd step its own workflow * no dup name * maybe fix error * remove dup key * don't hardcode bump yaml * Bump setup to 3.33.3 (#21) Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> * Change trigger hook * Bump setup to 2.22.2 (#22) Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> * remove dispatch * try on:push * Bump setup to 3.33.3 (#23) Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> * Bump setup to 1.84.1 (#24) Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> * push a tag * make sed portable * reset version * commit all files * Bump setup to 1.84.1 (#26) Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> * Cooper edit * sync * actually get token * perms * Bump setup to 1.84.0 (#29) Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com> * Don't negate? * Bump setup to 1.84.1 (#30) Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com> * escape properlly? * Bump setup to 1.84.0 (#31) Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com> * remove conditional * Bump setup to 1.84.1 (#32) Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com> * add back conditional * fake file * Change ext * Bump setup to 1.84.0 (#34) Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com> * Update autoapprove? * Fix checks * add --squash * del tag and tag * Bump setup to 1.84.1 (#37) Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com> * add ref: develop * Bump setup to 1.84.0 (#38) Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com> * Bump setup to 1.84.1 (#39) Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com> * Remove tag-version script and workflow * Add a small comment why we change ids * Don't push bogus changes * bogus --------- Co-authored-by: Yosef Alsuhaibani <yosefalsuhaibani@Yosefs-MacBook-Pro-2.local> Co-authored-by: Andre Kuhlenschmidt <andre@semgrep.com> Co-authored-by: semgrep-ci[bot] <semgrep-ci[bot]@users.noreply.github.com> Co-authored-by: semgrep-ci[bot] <106279034+semgrep-ci[bot]@users.noreply.github.com> Co-authored-by: yosefAlsuhaibani <yosefAlsuhaibani@users.noreply.github.com>
1 parent 3b9f235 commit b7192c5

2 files changed

Lines changed: 52 additions & 4 deletions

File tree

.github/workflows/autoapprove.yml

Lines changed: 51 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,60 @@ jobs:
1010
runs-on: ubuntu-latest
1111
if: ${{ github.actor == 'github-actions' || github.actor == 'semgrep-ci[bot]'}}
1212
steps:
13-
- name: Enable auto-merge
14-
run: gh pr merge --auto --squash "$PR_URL"
13+
- name: Approve
14+
run: gh pr review --approve "$PR_URL"
1515
env:
1616
PR_URL: ${{ github.event.pull_request.html_url }}
1717
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
18-
- name: Approve
19-
run: gh pr review --approve "$PR_URL"
18+
19+
- name: Watch untill PR checks are done
20+
run: gh pr checks --required --watch "$PR_URL"
21+
env:
22+
PR_URL: ${{ github.event.pull_request.html_url }}
23+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
24+
25+
- name: Merge PR
26+
run: gh pr merge --squash "$PR_URL"
2027
env:
2128
PR_URL: ${{ github.event.pull_request.html_url }}
2229
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
# Now we switch to semgrep-ci[bot] to actually be able to
32+
# move the tag we created in bump_version.yml from the
33+
# release branch to develop
34+
35+
- id: jwt
36+
env:
37+
EXPIRATION: 600
38+
ISSUER: ${{ secrets.SEMGREP_CI_APP_ID }}
39+
PRIVATE_KEY: ${{ secrets.SEMGREP_CI_APP_KEY }}
40+
name: Get JWT for semgrep-ci GitHub App
41+
uses: docker://public.ecr.aws/y9k7q4m1/devops/cicd:latest
42+
43+
- id: token
44+
name: Get token for semgrep-ci GitHub App
45+
run: |
46+
TOKEN="$(curl -X POST \
47+
-H "Authorization: Bearer ${{ steps.jwt.outputs.jwt }}" \
48+
-H "Accept: application/vnd.github.v3+json" \
49+
"https://api.github.com/app/installations/${{ secrets.SEMGREP_CI_APP_INSTALLATION_ID }}/access_tokens" | \
50+
jq -r .token)"
51+
echo "::add-mask::$TOKEN"
52+
echo "token=$TOKEN" >> $GITHUB_OUTPUT
53+
54+
- uses: actions/checkout@v4
55+
with:
56+
ref: develop
57+
token: ${{ steps.token.outputs.token }}
58+
59+
- name: Move tag to develop branch
60+
env:
61+
GITHUB_TOKEN: ${{ steps.token.outputs.token }}
62+
run: |
63+
CURR_VERSION=$(grep -o 'version=\"[0-9.]*\"' setup.py | sed "s/version=\"\([0-9.]*\)\"/\1/")
64+
# We tagged the release branch first in bump_version.yml
65+
# to allow tests to pass; now moving it to develop so
66+
# it can be a part of its history
67+
git push --delete origin "v${CURR_VERSION}"
68+
git tag "v${CURR_VERSION}" HEAD
69+
git push origin tag "v${CURR_VERSION}"

a.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
a

0 commit comments

Comments
 (0)