|
1 | | -name: PR Validate |
| 1 | +name: .PR Validate |
2 | 2 |
|
3 | 3 | on: |
4 | 4 | workflow_call: |
|
9 | 9 | default: 'true' |
10 | 10 | required: false |
11 | 11 | type: string |
12 | | - forks_allowed: |
| 12 | + reject_forks: |
13 | 13 | description: 'Are forks allowed? [true|false]' |
14 | 14 | default: 'false' |
15 | 15 | required: false |
|
20 | 20 | type: string |
21 | 21 |
|
22 | 22 | jobs: |
23 | | - conventional-commits: |
24 | | - name: Conventional Commits |
25 | | - if: inputs.conventional_commits != 'false' |
| 23 | + checks: |
| 24 | + name: Checks |
26 | 25 | runs-on: ubuntu-22.04 |
27 | 26 | steps: |
28 | | - - uses: amannn/action-semantic-pull-request@v5.4.0 |
| 27 | + # Conventional commits |
| 28 | + - name: Conventional Commits |
| 29 | + uses: amannn/action-semantic-pull-request@v5.4.0 |
| 30 | + if: inputs.conventional_commits != 'false' |
29 | 31 | env: |
30 | 32 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
31 | 33 |
|
32 | | - - if: failure() |
33 | | - run: | |
34 | | - echo "Please use conventional commits in your PR title and re-run this job." |
35 | | - echo "https://www.conventionalcommits.org/en/v1.0.0/" |
36 | | - exit 1 |
| 34 | + # Check for forks |
| 35 | + - name: Fork Check |
| 36 | + if: inputs.reject_forks != 'true' && github.event.pull_request.head.repo.fork |
| 37 | + run: exit 1 |
37 | 38 |
|
38 | | - block-forks: |
39 | | - name: Block Forks |
40 | | - if: inputs.forks_allowed != 'true' && github.event.pull_request.head.repo.fork |
41 | | - runs-on: ubuntu-22.04 |
42 | | - steps: |
43 | | - - name: Block Forks |
44 | | - run: | |
45 | | - echo "These workflows do not work with forks. Our apologies for any inconvenience." |
46 | | - exit 1 |
47 | | -
|
48 | | - description: |
49 | | - name: Description |
50 | | - if: inputs.markdown_links != '' |
51 | | - permissions: |
52 | | - pull-requests: write |
53 | | - runs-on: ubuntu-latest |
54 | | - steps: |
55 | | - - uses: bcgov-nr/action-pr-description-add@v1.1.1 |
| 39 | + # Add PR Description, doesn't work with forks |
| 40 | + - name: PR Description |
| 41 | + if: inputs.reject_forks != 'true' && inputs.markdown_links != '' |
| 42 | + uses: bcgov-nr/action-pr-description-add@v1.1.1 |
56 | 43 | env: |
57 | 44 | DOMAIN: apps.silver.devops.gov.bc.ca |
58 | 45 | PREFIX: ${{ github.event.repository.name }} |
|
70 | 57 |
|
71 | 58 | After merge, new images are deployed in: |
72 | 59 | - [Merge Workflow](https://github.com/${{ github.repository }}/actions/workflows/merge.yml) |
| 60 | +
|
| 61 | + # Notify of any failures |
| 62 | + - name: Errors |
| 63 | + if: failure() |
| 64 | + run: | |
| 65 | + echo "Validation failed! Possible reasons:" |
| 66 | + echo " - Forks are not supported" |
| 67 | + echo " - Conventional commits required for PR titles and merges" |
| 68 | + echo " https://www.conventionalcommits.org/en/v1.0.0/" |
| 69 | + exit 1 |
0 commit comments