-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (57 loc) · 2.07 KB
/
rebuild-bot.yml
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
# ~~ Generated by projen. To modify, edit .projenrc.js and run "npx projen".
name: rebuild-bot
on:
issue_comment:
types:
- created
workflow_dispatch: {}
jobs:
build:
runs-on: ubuntu-latest
env:
CI: "true"
if: ${{ github.event.issue.pull_request && contains(github.event.comment.body,
'@projen rebuild') }}
steps:
- name: Post comment to issue
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: "_projen_: Rebuild started"
- name: Get pull request branch
id: query_pull_request
env:
PULL_REQUEST_URL: ${{ github.event.issue.pull_request.url }}
run: |-
rm -f /tmp/pr.json
curl --silent $PULL_REQUEST_URL > /tmp/pr.json
BRANCH_STR=$(cat /tmp/pr.json | jq ".head.ref")
REPO_NAME=$(cat /tmp/pr.json | jq ".head.repo.full_name")
echo "::set-output name=branch::$(node -p $BRANCH_STR)"
echo "::set-output name=repo::$(node -p $REPO_NAME)"
- name: Checkout
uses: actions/checkout@v2
with:
ref: ${{ steps.query_pull_request.outputs.branch }}
repository: ${{ steps.query_pull_request.outputs.repo }}
- name: Install dependencies
run: yarn install --check-files --frozen-lockfile
- name: Synthesize project files
run: npx projen
- name: Set git identity
run: |-
git config user.name "Auto-bump"
git config user.email "github-actions@github.com"
- name: Build
run: npx projen build
- name: Commit changes
run: 'git commit -am "chore: update generated files"'
- name: Push changes
run: git push --follow-tags origin $BRANCH
env:
BRANCH: ${{ steps.query_pull_request.outputs.branch }}
- name: Post comment to issue
uses: peter-evans/create-or-update-comment@v1
with:
issue-number: ${{ github.event.issue.number }}
body: "_projen_: Rebuild complete. Updates pushed to pull request branch."