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