microsoft/typespec
Publicmirrored from https://github.com/microsoft/typespecAvailable
.github/workflows/tryit-comment.yml
36lines · modecode
| 1 | # IMPORTANT: DO NOT CHECKOUT |
| 2 | name: Make try it comment |
| 3 | |
| 4 | on: |
| 5 | pull_request_target: |
| 6 | types: [opened, reopened] |
| 7 | |
| 8 | concurrency: ${{ github.workflow }}-${{ github.ref }} |
| 9 | |
| 10 | # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages |
| 11 | permissions: |
| 12 | pull-requests: write |
| 13 | |
| 14 | jobs: |
| 15 | # Create PR |
| 16 | pr_created: |
| 17 | name: Provide try it comments |
| 18 | runs-on: ubuntu-latest |
| 19 | steps: |
| 20 | - uses: actions/github-script@v5 |
| 21 | with: |
| 22 | github-token: ${{secrets.GITHUB_TOKEN}} |
| 23 | script: | |
| 24 | const prNumber = ${{ github.event.pull_request.number }}; |
| 25 | github.rest.issues.createComment({ |
| 26 | issue_number: context.issue.number, |
| 27 | owner: context.repo.owner, |
| 28 | repo: context.repo.repo, |
| 29 | body: [ |
| 30 | `Changes in this PR will be published to the following url to try(check status of TypeSpec Pull Request Try It pipeline for publish status):`, |
| 31 | `Playground: https://cadlplayground.z22.web.core.windows.net/prs/${prNumber}/`, |
| 32 | "", |
| 33 | `Website: https://tspwebsitepr.z5.web.core.windows.net/prs/${prNumber}/`, |
| 34 | |
| 35 | ].join("\n") |
| 36 | }) |
| 37 | |