rebuild-bot #395
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ~~ 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." |