fix: notification service failing in Kubernetes #13
Workflow file for this run
This file contains hidden or 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
| name: PR Auto Comment | |
| on: | |
| pull_request_target: | |
| branches: | |
| - master | |
| - stage | |
| types: | |
| - opened | |
| permissions: | |
| pull-requests: write | |
| issues: write | |
| jobs: | |
| comment: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Comment for PR for branch master | |
| if: github.event.pull_request.base.ref == 'master' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const user = context.payload.pull_request.user.login | |
| const commentBody = `### 🚫 Pull Request Policy Violation\n\nHi @${user}, thanks for your contribution! \n\nDirect PRs to the **master** branch are not allowed. Please close this PR and target the **stage** branch instead for review.`; | |
| await github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number: prNumber, | |
| body: commentBody | |
| }); | |
| await github.rest.pulls.update({ | |
| owner, | |
| repo, | |
| pull_number: prNumber, | |
| state: 'closed' | |
| }); | |
| - name: Comment for PR for other branches | |
| if: github.event.pull_request.base.ref != 'master' | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const prNumber = context.payload.pull_request.number; | |
| const owner = context.repo.owner; | |
| const repo = context.repo.repo; | |
| const user = context.payload.pull_request.user.login | |
| const commentBody = `### Hi @${user} Thanks for creating a PR for your Issue! ☺️\n\nWe'll review it as soon as possible.\nIn the meantime, please double-check the **file changes** and ensure that **all commits** are accurate.\n\nIf there are any **unresolved review comments**, feel free to resolve them. 🙌🏼`; | |
| await github.rest.issues.createComment({ | |
| owner, | |
| repo, | |
| issue_number: prNumber, | |
| body: commentBody | |
| }); | |