Skip to content

Commit 293a530

Browse files
committed
Updated GitHub Actions workflow to differentiate webhook calls for master and non-master branches, enhancing deployment logic.
1 parent 518a8d4 commit 293a530

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

.github/workflows/docs-to-vector.yml

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,30 +5,33 @@ on:
55
push:
66
branches:
77
- master
8-
9-
env:
10-
TARGET_BRANCH: ${{ github.ref_name }}
8+
- docs-to-vector
119

1210
jobs:
1311
build:
1412
runs-on: ubuntu-latest
1513
steps:
16-
- name: Connect Tailscale
17-
# if branch is not master
14+
- name: Call Webhook (Master)
15+
if: ${{ github.ref_name == 'master' }}
16+
run: |
17+
curl -X POST \
18+
-H "Content-Type: application/json" \
19+
-d '{"commit_id": "${{ github.sha }}", "branch": "${{ github.ref_name }}"}' \
20+
${{ secrets.VECTOR_WEBHOOK_URL }}
21+
22+
- name: Connect to company network
1823
if: ${{ github.ref_name != 'master' }}
1924
uses: tailscale/github-action@v3
2025
with:
2126
oauth-client-id: ${{ secrets.TS_OAUTH_CLIENT_ID }}
2227
oauth-secret: ${{ secrets.TS_OAUTH_SECRET }}
2328
tags: tag:ci
2429

25-
- name: Call Webhook
30+
- name: Call Webhook (Preview)
31+
if: ${{ github.ref_name != 'master' }}
2632
run: |
27-
WEBHOOK_URL=${{ secrets.VECTOR_WEBHOOK_URL }}
28-
if [ "${{ env.TARGET_BRANCH }}" != "master" ]; then
29-
WEBHOOK_URL=${{ secrets.VECTOR_WEBHOOK_URL_PREVIEW }}
30-
fi
3133
curl -X POST \
3234
-H "Content-Type: application/json" \
3335
-d '{"commit_id": "${{ github.sha }}", "branch": "${{ github.ref_name }}"}' \
34-
${WEBHOOK_URL}
36+
${{ secrets.VECTOR_WEBHOOK_URL_PREVIEW }}
37+

0 commit comments

Comments
 (0)