-
Notifications
You must be signed in to change notification settings - Fork 13
96 lines (84 loc) · 2.96 KB
/
propagate.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
84
85
86
87
88
89
90
91
92
93
94
95
96
name: Propagate-PR
# === Triggers ===
"on":
pull_request:
types:
- closed
# === JOBS ===
jobs:
# === Set target branch ===
propagate:
name: Propagate to affected version branches
runs-on: ubuntu-20.04
env:
ACTIVESTATE_CI: true
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
JIRA_USERNAME: ${{ secrets.JIRA_EMAIL }}
JIRA_TOKEN: ${{ secrets.JIRA_TOKEN }}
timeout-minutes: 5
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.base.ref, 'version/')
steps:
- # === Checkout code ===
name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.GH_AUTOMATION_TOKEN }}
- # === Install Go ===
name: Install Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
- # === Install State Tool ===
name: Install State Tool
uses: ActiveState/setup-state-tool@v1
- # === Setup ===
name: Setup
shell: bash
run: |
# We specify our custom user because we need privileges to push to protected branches
git config user.name "AS-builds"
git config user.email "[email protected]"
- # === Preprocess ===
name: Preprocess
shell: bash
run: state run preprocess -v
- # === Propagate PR ===
name: Propagate PR
id: propagate_pr
shell: bash
run: go run scripts/ci/propagate-pr/main.go ${{ github.event.pull_request.number }}
continue-on-error: true
- # === Notify Slack of Failures ===
name: Notify Slack of Failures
if: steps.propagate_pr.outcome == 'failure'
uses: slackapi/[email protected]
with:
payload: |
{
"text": "Propagate-PR failed for ${{ github.event.pull_request.html_url }}\nFailure should be addressed by ${{ github.event.pull_request.user.login }}",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Propagate-PR failed for *<${{ github.event.pull_request.html_url }}|${{ github.event.pull_request.title }}>*\nFailure should be addressed by *${{ github.event.pull_request.user.login }}*"
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "Failed job: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- # === Fail If Propagate PR failed ===
name: Fail If Propagate PR failed
if: steps.propagate_pr.outcome == 'failure'
shell: bash
run: exit 1