-
Notifications
You must be signed in to change notification settings - Fork 4
37 lines (36 loc) · 1.24 KB
/
TriggerTagBot.yml
File metadata and controls
37 lines (36 loc) · 1.24 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
name: TriggerTagBot
on:
push:
branches:
- master
workflow_dispatch:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 2
- name: Get updated package name
id: pkg
run: |
PACKAGENAME=$(git diff HEAD^ --stat | grep /Versions.toml | cut -d/ -f2 | uniq)
echo "Package name is: $PACKAGENAME"
echo "packagename=$PACKAGENAME" >> "$GITHUB_ENV"
- name: Run `repository_dispatch` on updated repo, to trigger tagbot
env:
TAGBOT_PAT: ${{ secrets.TAGBOT_TOKEN }}
run: |
if [ -z "$packagename" ]; then
echo "No package name detected, skipping dispatch"
exit 0
fi
echo "Triggering TagBot for: $packagename"
payload=$(printf '{"event_type":"TagBot","client_payload":{"repository":"%s"}}' "$GITHUB_REPOSITORY")
curl --http1.1 -X POST \
"https://api.github.com/repos/HolyLab/${packagename}.jl/dispatches" \
-H 'Accept: application/vnd.github.everest-preview+json' \
-H "Authorization: Bearer $TAGBOT_PAT" \
-H 'Content-Type: application/json' \
--verbose \
--data "$payload"