|
| 1 | +name: Auto release excalidraw preview |
| 2 | +on: |
| 3 | + issue_comment: |
| 4 | + types: [created, edited] |
| 5 | + |
| 6 | +jobs: |
| 7 | + Auto-release-excalidraw-preview: |
| 8 | + name: Auto release preview |
| 9 | + if: github.event.comment.body == '@excalibot trigger release' && github.event.issue.pull_request |
| 10 | + runs-on: ubuntu-latest |
| 11 | + steps: |
| 12 | + - name: React to release comment |
| 13 | + uses: peter-evans/create-or-update-comment@v1 |
| 14 | + with: |
| 15 | + token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }} |
| 16 | + comment-id: ${{ github.event.comment.id }} |
| 17 | + reactions: "+1" |
| 18 | + - name: Get PR SHA |
| 19 | + id: sha |
| 20 | + uses: actions/github-script@v4 |
| 21 | + with: |
| 22 | + result-encoding: string |
| 23 | + script: | |
| 24 | + const { owner, repo, number } = context.issue; |
| 25 | + const pr = await github.pulls.get({ |
| 26 | + owner, |
| 27 | + repo, |
| 28 | + pull_number: number, |
| 29 | + }); |
| 30 | + return pr.data.head.sha |
| 31 | + - uses: actions/checkout@v2 |
| 32 | + with: |
| 33 | + ref: ${{ steps.sha.outputs.result }} |
| 34 | + fetch-depth: 2 |
| 35 | + - name: Setup Node.js 20.x |
| 36 | + uses: actions/setup-node@v2 |
| 37 | + with: |
| 38 | + node-version: 20.x |
| 39 | + - name: Set up publish access |
| 40 | + run: | |
| 41 | + npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} |
| 42 | + env: |
| 43 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 44 | + - name: Auto release preview |
| 45 | + id: "autorelease" |
| 46 | + run: | |
| 47 | + yarn add @actions/core -W |
| 48 | + yarn autorelease preview ${{ github.event.issue.number }} |
| 49 | + - name: Post comment post release |
| 50 | + if: always() |
| 51 | + uses: peter-evans/create-or-update-comment@v1 |
| 52 | + with: |
| 53 | + token: ${{ secrets.PUSH_TRANSLATIONS_COVERAGE_PAT }} |
| 54 | + issue-number: ${{ github.event.issue.number }} |
| 55 | + body: "@${{ github.event.comment.user.login }} ${{ steps.autorelease.outputs.result }}" |
0 commit comments