-
Notifications
You must be signed in to change notification settings - Fork 27
56 lines (44 loc) · 1.35 KB
/
archiveTooting.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
name: Archive Tooting
on:
pull_request:
types: [closed]
workflow_dispatch: # manual triggering
jobs:
toot_update:
if: |
github.event.pull_request.merged == true &&
github.event.pull_request.title == '[Automatic PR] Update chronicle file'
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install dependencies
run: |
pip install requests
- name: Construct diff URL
id: construct_diff_url
run: |
echo ${{ github.event.pull_request.diff_url }} > diff_url.txt
- name: Fetch PR diff
run: |
curl -L $(cat diff_url.txt) -o diff.txt
- name: Run parseDiffForMastodon.py
run: |
python3 parseDiffForMastodon.py < diff.txt > message.txt
- name: Print message
run: cat message.txt
- name: Append message to a variable
run: |
echo 'MESSAGE_ENV<<EOF' >> $GITHUB_ENV
cat message.txt >> $GITHUB_ENV
echo 'EOF' >> $GITHUB_ENV
- name: Toot!
uses: rzr/fediverse-action@master
with:
access-token: ${{ secrets.MASTODON_ACCESS_TOKEN }}
host: "ecoevo.social" # custom host if not "mastodon.social" (default)
message: ${{ env.MESSAGE_ENV }}