-
Notifications
You must be signed in to change notification settings - Fork 9.2k
83 lines (73 loc) · 2.7 KB
/
regressions.yml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: Handle Regressions
permissions: {}
on:
issues:
types:
- labeled
pull_request_target:
types:
- labeled
jobs:
process:
name: Process Regression
if: github.event.label.name == 'regression'
runs-on: ubuntu-latest
env:
ISSUE_URL: ${{ github.event.issue.html_url || github.event.pull_request.html_url }}
steps:
- name: Send Slack Notification
uses: slackapi/slack-github-action@70cd7be8e40a46e8b0eced40b0de447bdb42f68e # v1.26.0
env:
ISSUE_TITLE: ${{ toJSON(github.event.issue.title || github.event.pull_request.title) }}
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel-id: ${{ secrets.SLACK_CHANNEL }}
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ":warning: The following has been labeled as a regression:"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format('<{0}|{1}>', env.ISSUE_URL, env.ISSUE_TITLE)) }}
}
}
]
}
- name: Generate GitHub App Token
id: token
uses: actions/create-github-app-token@31c86eb3b33c9b601a1f60f98dcbfd1d70f379b4 # v1.10.3
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PEM }}
- name: Add prioritized Label
env:
GH_CLI_SUBCOMMAND: ${{ github.event_name == 'pull_request_target' && 'pr' || 'issue' }}
GH_TOKEN: ${{ steps.token.outputs.token }}
run: |
gh $GH_CLI_SUBCOMMAND edit "$ISSUE_URL" --add-label prioritized
- name: Move to the Top of the Team Working Board
env:
GH_TOKEN: ${{ steps.token.outputs.token }}
run: |
PROJECT_ITEM_ID=$(gh project item-add 196 --owner "hashicorp" --url "$ISSUE_URL" --format json --jq '.id')
gh project item-edit \
--id "$PROJECT_ITEM_ID" \
--project-id "PVT_kwDOAAuecM4AF-7h" \
--field-id "PVTSSF_lADOAAuecM4AF-7hzgMRB34" \
--single-select-option-id "${{ vars.team_project_view_working_board }}"
gh api graphql \
-F itemId="$PROJECT_ITEM_ID" \
-F projectId="PVT_kwDOAAuecM4AF-7h" \
-f query='mutation($itemId:ID!, $projectId:ID!) {
updateProjectV2ItemPosition(input:{itemId:$itemId, projectId:$projectId}) {
clientMutationId
}
}'