-
Notifications
You must be signed in to change notification settings - Fork 13
106 lines (91 loc) · 3.14 KB
/
release-assistant.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
97
98
99
100
101
102
103
104
105
106
name: Release Assistant
on:
pull_request:
branches: [ master ]
types: [ opened, labeled ]
workflow_dispatch:
schedule:
- cron: '49 1 * * 1' # 1:49 AM UTC every Monday
jobs:
create-comment:
name: Create Comment
runs-on: ubuntu-latest
if: |
github.event_name == 'pull_request'
&& github.event.pull_request.user.login != 'CBenoit'
&& github.event.pull_request.user.login != 'dependabot'
&& github.event.pull_request.head.repo.full_name == github.repository
steps:
- uses: actions/checkout@v4
- if: github.event.action == 'opened'
uses: ./.github/actions/create-comment
with:
template: ${{ github.workspace }}/.github/comments/pr_greetings.md
- if: github.event.action == 'labeled' && github.event.label.name == 'publish-required'
uses: ./.github/actions/create-comment
with:
template: ${{ github.workspace }}/.github/comments/publish_requested.md
- if: github.event.action == 'labeled' && github.event.label.name == 'release-required'
uses: ./.github/actions/create-comment
with:
template: ${{ github.workspace }}/.github/comments/release_requested.md
notify-slack:
name: Notify Slack
runs-on: ubuntu-latest
if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_ARCHITECTURE }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
strategy:
matrix:
required-label: [ release-required, publish-required ]
include:
- required-label: release-required
blocker-label: release-blocker
message: Please cut a release
- required-label: publish-required
blocker-label: publish-blocker
message: Please publish libraries
steps:
- uses: actions/checkout@v4
- name: Verify labels
id: verify-labels
shell: pwsh
env:
GITHUB_TOKEN: ${{ github.token }}
run: |
Set-PSDebug -Trace 1
$blockerCount = ./ci/pr-count-for-label.ps1 -Label '${{ matrix.blocker-label }}'
if ($blockerCount -ne 0)
{
Write-Output "notify=no" >> $Env:GITHUB_OUTPUT
}
else
{
$requiredCount = ./ci/pr-count-for-label.ps1 -Label '${{ matrix.required-label }}'
if ($requiredCount -ne 0)
{
Write-Output "notify=yes" >> $Env:GITHUB_OUTPUT
}
else
{
Write-Output "notify=no" >> $Env:GITHUB_OUTPUT
}
}
- name: Send slack notification
id: slack
if: steps.verify-labels.outputs.notify == 'yes'
uses: slackapi/[email protected]
with:
payload: |
{
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*${{ github.repository }}* :recycle: \n ${{ matrix.message }} for *${{ github.repository }}*"
}
}
]
}