Matthias Andreas Benkard | 1ba5381 | 2022-12-27 17:32:58 +0100 | [diff] [blame^] | 1 | name: Check PRs if on staging |
| 2 | on: |
| 3 | pull_request_target: |
| 4 | types: [opened, edited] |
| 5 | permissions: {} |
| 6 | |
| 7 | jobs: |
| 8 | is_not_staging: |
| 9 | runs-on: ubuntu-latest |
| 10 | if: github.event.pull_request.base.ref != 'staging' #check if the target branch is not staging |
| 11 | steps: |
| 12 | - name: Send message |
| 13 | uses: thollander/actions-comment-pull-request@main |
| 14 | with: |
| 15 | GITHUB_TOKEN: ${{ secrets.CHECKIFPRISSTAGING_ACTION_PAT }} |
| 16 | message: | |
| 17 | Thanks for contributing! |
| 18 | |
| 19 | I noticed that you didn't select `staging` as your base branch. Please change the base branch to `staging`. |
| 20 | See the attached picture on how to change the base branch to `staging`: |
| 21 | |
| 22 | ![check_prs_if_on_staging.png](https://raw.githubusercontent.com/mailcow/mailcow-dockerized/master/.github/workflows/assets/check_prs_if_on_staging.png) |
| 23 | |
| 24 | - name: Fail #we want to see failed checks in the PR |
| 25 | if: ${{ success() }} #set exit code to 1 even if commenting somehow failed |
| 26 | run: exit 1 |
| 27 | |
| 28 | is_staging: |
| 29 | runs-on: ubuntu-latest |
| 30 | if: github.event.pull_request.base.ref == 'staging' #check if the target branch is staging |
| 31 | steps: |
| 32 | - name: Success |
| 33 | run: exit 0 |