Skip to content

Commit 3385209

Browse files
authored
Merge pull request #118 from salesforcecli/ew/validate-pr-envs
Use envs on validate PR
2 parents 34c9f6c + 1661943 commit 3385209

1 file changed

Lines changed: 20 additions & 14 deletions

File tree

.github/workflows/validatePR.yml

Lines changed: 20 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,47 +7,53 @@ jobs:
77
if: ${{ !contains(github.event.pull_request.body, '[skip-validate-pr]') && !contains(github.event.pull_request.title, '[skip-validate-pr]') }}
88
runs-on: "ubuntu-latest"
99
steps:
10-
- uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8
10+
- name: Find GUS Work Item
11+
uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8
1112
id: regex-match-gus-wi
1213
with:
1314
text: ${{ github.event.pull_request.body }}
1415
regex: '@W-\d{7,8}@'
1516
flags: gm
16-
- uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8
17+
18+
- name: Find Github Action Run
19+
uses: kaisugi/action-regex-match@45cc5bacf016a4c0d2c3c9d0f8b7c2f1b79687b8
1720
id: regex-match-gha-run
1821
with:
1922
text: ${{ github.event.pull_request.body }}
2023
regex: 'https:\/\/github\.com\/[\w\.-]+\/[\w\.-]+\/actions\/runs\/'
2124
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
2928
id: regex-match-cli-gh-issue
3029
with:
3130
text: ${{ github.event.pull_request.body }}
3231
regex: 'forcedotcom\/cli\/issues\/[0-9]+|forcedotcom\/salesforcedx-vscode\/issues\/[0-9]+'
3332
flags: gm
34-
- name: fail
33+
34+
- name: Fail if no references
3535
if: |
3636
github.event.pull_request.user.login != 'dependabot[bot]' &&
3737
(github.event.pull_request.user.login != 'SF-CLI-BOT' || github.event.pull_request.user.login != 'svc-cli-bot') &&
3838
steps.regex-match-gus-wi.outputs.match == '' &&
39-
steps.regex-match-gh-issue.outputs.match == '' &&
4039
steps.regex-match-gha-run.outputs.match == '' &&
4140
steps.regex-match-cli-gh-issue.match == ''
4241
run: |
4342
echo "PR does not reference work item or github issue or github action run."
4443
echo "GUS WIs should be wrapped in @s, ex: @W-12345678@ or [@W-12345678@](https://some-url) or include a full GHA run link"
4544
exit 1
46-
- name: output success
45+
46+
- name: Output matches
4747
if: |
4848
steps.regex-match-gus-wi.outputs.match != '' ||
4949
steps.regex-match-gha-run.outputs.match != '' ||
50-
steps.regex-match-gh-issue.outputs.match != '' ||
5150
steps.regex-match-cli-gh-issue.match != ''
5251
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

Comments
 (0)