-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (43 loc) · 1.88 KB
/
example.yml
File metadata and controls
44 lines (43 loc) · 1.88 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
name: Example
on:
pull_request:
# Adding "edited" because I'm checking the text content of the PR description
types: [opened, synchronize, reopened, edited]
jobs:
offerHelp:
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
steps:
- name: 'Check out code'
uses: actions/checkout@v4
- name: See if there are problems
id: check-for-issues
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea
with:
script: |
const prBody = context.payload.pull_request.body || "";
let issue = "";
const match = prBody.match(/run the test workflow(?: (\w+))?/i);
if (match) {
if (match[1]) {
issue = `It looks like your PR description has the phrase "run the test workflow ${match[1]}" in it`;
} else {
issue = 'It looks like your PR description has the phrase "run the test workflow" in it';
}
}
core.setOutput("issue", issue);
- name: Add guidance comment
# uses: betatorbust/guidance-comment@v1
uses: ./ # using the local version of ^^
with:
name: 'example-guidance'
pr-number: ${{github.event.pull_request.number}}
show-guidance:
${{ steps.check-for-issues.outputs.issue != '' }}
guidance-comment: |
Hi! It looks like there might be an issue:
${{ steps.check-for-issues.outputs.issue }}
resolved-comment: |
Thanks for addressing the issue!