forked from openpracticelibrary/openpracticelibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
32 lines (29 loc) · 1.22 KB
/
tweet-new-practice.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
# This workflows sends a new tweet everytime a new practice is merged into master.
name: tweet-new-practice
on:
push:
branches: [master]
paths:
- "src/pages/practice/*.md"
jobs:
tweet:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
with:
fetch-depth: 2
- name: extract practice name
run: |
export EXTRACTED_PRACTICE=$(git diff --diff-filter=A --name-only HEAD^ | grep "src/pages/practice/" | sed -E "s/src\/pages\/practice\///" | sed -E "s/.md//")
echo "Extracted practice name: [${EXTRACTED_PRACTICE}]"
echo "NEW_PRACTICE=${EXTRACTED_PRACTICE}" >> $GITHUB_ENV
- name: send tweet
if: ${{ env.NEW_PRACTICE != '' }}
uses: ethomson/send-tweet-action@v1
with:
status: "New practice published: https://openpracticelibrary.com/practice/${{ env.NEW_PRACTICE }} #OpenPractice #openpracticelibrary #agile #opensource"
consumer-key: ${{ secrets.TWITTER_CONSUMER_API_KEY }}
consumer-secret: ${{ secrets.TWITTER_CONSUMER_API_SECRET }}
access-token: ${{ secrets.TWITTER_ACCESS_TOKEN }}
access-token-secret: ${{ secrets.TWITTER_ACCESS_TOKEN_SECRET }}