Skip to content

Commit e736dd9

Browse files
committed
Add workflow to trigger Zapier endpoint
1 parent 757ad73 commit e736dd9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

.github/workflows/zapier.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Trigger Zap on Main Branch Merge
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
trigger-webhook:
10+
runs-on: ubuntu-latest
11+
# Only run this workflow if the repository is public
12+
if: github.event.repository.private == false
13+
steps:
14+
- name: Check out repository
15+
uses: actions/checkout@v3
16+
with:
17+
fetch-depth: 2 # To get the commit message from the last commit
18+
19+
- name: Get commit message
20+
id: get_commit_message
21+
run: |
22+
COMMIT_MESSAGE=$(git log -1 --pretty=format:%B)
23+
COMMIT_MESSAGE="${COMMIT_MESSAGE//'%'/'%25'}"
24+
COMMIT_MESSAGE="${COMMIT_MESSAGE//$'\n'/'%0A'}"
25+
COMMIT_MESSAGE="${COMMIT_MESSAGE//$'\r'/'%0D'}"
26+
echo "::set-output name=message::$COMMIT_MESSAGE"
27+
# For newer GitHub Actions:
28+
echo "message=$COMMIT_MESSAGE" >> $GITHUB_OUTPUT
29+
30+
- name: Send webhook
31+
uses: distributhor/workflow-webhook@v3
32+
with:
33+
webhook_url: ${{ secrets.ZAPIER_TWEET_URL }}
34+
webhook_secret: ${{ secrets.ZAPIER_TWEET_URL_SECRET }}
35+
data: '{"commit_message": "${{ steps.get_commit_message.outputs.message }}"}'
36+
content_type: application/json

0 commit comments

Comments
 (0)