-
Notifications
You must be signed in to change notification settings - Fork 462
86 lines (82 loc) · 3.21 KB
/
feed.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
# This workflow updates feeds when the label `new package` is applied to PRs.
name: Send to feeds
on:
pull_request:
types: [ labeled ]
permissions:
contents: read
jobs:
update-slack:
if: ${{ github.event.label.name == 'new package' && github.repository == github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@f40c4b69330df1d22e7590c12e76dc2f9c66e0bc # v1.9.2
with:
version: 1.6.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v3.3.0
- name: Send to Slack
shell: julia --color=yes {0}
run: |
endpoint = ENV["SLACK_ENDPOINT"]
if isempty(endpoint)
@info "Endpoint not specified; missing secret? Exiting."
exit(0)
end
include(joinpath(ENV["GITHUB_WORKSPACE"], ".ci", "parse_env.jl"))
text, pr_url = parse_env(ENV)
using Pkg
Pkg.activate(mktempdir())
Pkg.add(name="Slack", version="0.1")
using Slack
data = Dict("attachments" =>
[Dict("fallback" => ENV["PR_NAME"],
"color" => "#36a64f",
"title" => ENV["PR_NAME"],
"title_link" => pr_url,
"text" => text,
)])
if !startswith(endpoint, "/")
endpoint = string("/", endpoint)
end
@info "Told Slack: $(data)"
response = sendattachmenttoslack(data, endpoint)
@info "Slack said: $response"
env:
SLACK_ENDPOINT: ${{ secrets.JULIALANGSLACKENDPOINT }}
PR_NAME: ${{ github.event.pull_request.title }}
PR_NUMBER: ${{ github.event.number }}
PR_BODY: ${{ github.event.pull_request.body }}
update-zulip:
if: ${{ (github.event.label.name == 'new package' || github.event.label.name == 'zulip test') && github.repository == github.event.pull_request.head.repo.full_name }}
runs-on: ubuntu-latest
steps:
- uses: julia-actions/setup-julia@f40c4b69330df1d22e7590c12e76dc2f9c66e0bc
with:
version: 1.6.2
- uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v2.3.4
- name: Collect Zulip info
id: zulip
shell: julia --color=yes {0}
run: |
include(joinpath(ENV["GITHUB_WORKSPACE"], ".ci", "parse_env.jl"))
text, pr_url = parse_env(ENV)
using Pkg
Pkg.activate(mktempdir())
Pkg.add(name="GitHubActions", version="0.1")
using GitHubActions
content = string("**", ENV["PR_NAME"], "**\n\n", text)
set_output("content", content)
env:
PR_NAME: ${{ github.event.pull_request.title }}
PR_NUMBER: ${{ github.event.number }}
PR_BODY: ${{ github.event.pull_request.body }}
- name: Update Zulip feed
uses: zulip/github-actions-zulip/send-message@b62d5a0e48a4d984ea4fce5dd65ba691963d4db4
with:
api-key: ${{ secrets.ZULIP_API_KEY }}
email: 'general-registry-announcer-bot@julialang.zulipchat.com'
organization-url: 'https://julialang.zulipchat.com'
to: 'new-packages-feed'
type: 'stream'
topic: 'New package registrations'
content: ${{ steps.zulip.outputs.content }}