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