|
5 | 5 | if: ${{ !contains(github.event.pull_request.body, '[skip-validate-pr]') && !contains(github.event.pull_request.title, '[skip-validate-pr]') }} |
6 | 6 | runs-on: "ubuntu-latest" |
7 | 7 | steps: |
8 | | - - name: Find GUS Work Item |
| 8 | + - name: Find GUS Work Item in Title |
9 | 9 | uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 |
10 | | - id: regex-match-gus-wi |
| 10 | + id: regex-match-gus-wi-title |
11 | 11 | with: |
12 | | - text: ${{ github.event.pull_request.body }} |
13 | | - regex: '@W-\d{7,8}@' |
14 | | - flags: gm |
| 12 | + text: ${{ github.event.pull_request.title }} |
| 13 | + regex: 'W-\d{7,8}' |
| 14 | + flags: gmi |
15 | 15 |
|
16 | | - - name: Find Github Action Run |
| 16 | + - name: Find GUS Work Item in Body |
17 | 17 | uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 |
18 | | - id: regex-match-gha-run |
| 18 | + id: regex-match-gus-wi-body |
19 | 19 | with: |
20 | 20 | text: ${{ github.event.pull_request.body }} |
21 | | - regex: 'https:\/\/github\.com\/[\w\.-]+\/[\w\.-]+\/actions\/runs\/' |
22 | | - flags: gm |
| 21 | + regex: '@W-\d{7,8}@' |
| 22 | + flags: gmi |
23 | 23 |
|
24 | | - - name: Find CLI Github Issue |
25 | | - uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 |
26 | | - id: regex-match-cli-gh-issue |
27 | | - with: |
28 | | - text: ${{ github.event.pull_request.body }} |
29 | | - regex: 'forcedotcom\/cli\/issues\/[0-9]+|forcedotcom\/salesforcedx-vscode\/issues\/[0-9]+' |
30 | | - flags: gm |
| 24 | + # Disabling GHA Run and Github Issue (for now) due to E360 lookup |
31 | 25 |
|
32 | | - - name: Fail if no references |
| 26 | + # - name: Find Github Action Run |
| 27 | + # uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 |
| 28 | + # id: regex-match-gha-run |
| 29 | + # with: |
| 30 | + # text: ${{ github.event.pull_request.body }} |
| 31 | + # regex: 'https:\/\/github\.com\/[\w\.-]+\/[\w\.-]+\/actions\/runs\/' |
| 32 | + # flags: gm |
| 33 | + |
| 34 | + # - name: Find CLI Github Issue |
| 35 | + # uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8 |
| 36 | + # id: regex-match-cli-gh-issue |
| 37 | + # with: |
| 38 | + # text: ${{ github.event.pull_request.body }} |
| 39 | + # regex: 'forcedotcom\/cli\/issues\/[0-9]+|forcedotcom\/salesforcedx-vscode\/issues\/[0-9]+' |
| 40 | + # flags: gm |
| 41 | + |
| 42 | + - name: Fail if no Work Item references |
33 | 43 | if: | |
34 | 44 | github.event.pull_request.user.login != 'dependabot[bot]' && |
35 | 45 | (github.event.pull_request.user.login != 'SF-CLI-BOT' || github.event.pull_request.user.login != 'svc-cli-bot') && |
36 | | - steps.regex-match-gus-wi.outputs.match == '' && |
37 | | - steps.regex-match-gha-run.outputs.match == '' && |
38 | | - steps.regex-match-cli-gh-issue.match == '' |
| 46 | + (steps.regex-match-gus-wi-title.outputs.match == '' || steps.regex-match-gus-wi-body.outputs.match == '') |
39 | 47 | run: | |
40 | | - echo "PR does not reference work item or github issue or github action run." |
41 | | - echo "GUS WIs should be wrapped in @s, ex: @W-12345678@ or [@W-12345678@](https://some-url) or include a full GHA run link" |
| 48 | + echo "::warning::PRs need to reference a GUS Work Item in both the PR title AND body. More details in the logs above. |
| 49 | + - PR titles should start with a Work Item followed by a description, ex: W-12345678: My PR title |
| 50 | + - PR bodies must include a Work Item wrapped in @s, ex: @W-12345678@ or [@W-12345678@](https://some-url) |
| 51 | + - If you absolutely must skip this validation, add [skip-validate-pr] to the PR title or body" |
42 | 52 | exit 1 |
43 | 53 |
|
44 | | - - name: Output matches |
45 | | - if: | |
46 | | - steps.regex-match-gus-wi.outputs.match != '' || |
47 | | - steps.regex-match-gha-run.outputs.match != '' || |
48 | | - steps.regex-match-cli-gh-issue.match != '' |
49 | | - run: | |
50 | | - echo "[INFO] Gus Work Item: $STEPS_GUS_WI" |
51 | | - echo "[INFO] Github Action Run: $STEPS_GHA_RUN" |
52 | | - echo "[INFO] CLI Github Issue: $STEPS_CLI_GH_ISSUE" |
53 | | - env: |
54 | | - STEPS_GUS_WI: ${{ steps.regex-match-gus-wi.outputs.match }} |
55 | | - STEPS_GHA_RUN: ${{ steps.regex-match-gha-run.outputs.match }} |
56 | | - STEPS_CLI_GH_ISSUE: ${{ steps.regex-match-cli-gh-issue.match }} |
57 | | - |
0 commit comments