-
Notifications
You must be signed in to change notification settings - Fork 996
46 lines (46 loc) · 1.83 KB
/
issue-regression-labeler.yml
File metadata and controls
46 lines (46 loc) · 1.83 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
# Apply potential regression label on issues
name: issue-regression-label
on:
issues:
types: [opened, edited]
jobs:
add-regression-label:
if: github.repository == 'aws/aws-sdk-java-v2'
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Fetch template body
id: check_regression
uses: actions/github-script@v8
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEMPLATE_BODY: ${{ github.event.issue.body }}
with:
script: |
const regressionPattern = /\[x\] Select this option if this issue appears to be a regression\./i;
const template = `${process.env.TEMPLATE_BODY}`
const match = regressionPattern.test(template);
core.setOutput('is_regression', match);
- name: Manage regression label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
if [ "${{ steps.check_regression.outputs.is_regression }}" == "true" ]; then
gh issue edit ${{ github.event.issue.number }} --add-label "potential-regression" -R ${{ github.repository }}
else
gh issue edit ${{ github.event.issue.number }} --remove-label "potential-regression" -R ${{ github.repository }}
fi
- name: Notify Slack
if: steps.check_regression.outputs.is_regression == 'true' && github.event.action == 'opened'
run: |
curl -sfS -X POST "$SLACK_WEBHOOK_URL" \
-H 'Content-type: application/json' \
--data "$(jq -n \
--arg text "🚨 Potential regression reported: <$ISSUE_URL|#$ISSUE_NUM: $ISSUE_TITLE>" \
'{text: $text}')"
env:
SLACK_WEBHOOK_URL: ${{ secrets.CI_SLACK_WEBHOOK_URL }}
ISSUE_URL: ${{ github.event.issue.html_url }}
ISSUE_NUM: ${{ github.event.issue.number }}
ISSUE_TITLE: ${{ github.event.issue.title }}