-
Notifications
You must be signed in to change notification settings - Fork 108
46 lines (42 loc) · 1.38 KB
/
sync.yml
File metadata and controls
46 lines (42 loc) · 1.38 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
38
39
40
41
42
43
44
45
46
name: "(Sync): Core to Beta and Pro"
on:
push:
branches:
- core
- pro
jobs:
check-sync:
runs-on: ubuntu-latest
outputs:
should_sync: ${{ steps.check.outputs.should_sync }}
steps:
- name: Check if sync is required
id: check
run: |
{
echo 'COMMIT_MSG<<__EOF__'
echo '${{ github.event.head_commit.message }}'
echo '__EOF__'
} >> "$GITHUB_ENV"
if [[ "$COMMIT_MSG" == *"(sync):"* ]]; then
echo "should_sync=true" >> "$GITHUB_OUTPUT"
echo "::notice::Commit message contains (sync): - triggering sync workflow"
else
echo "should_sync=false" >> "$GITHUB_OUTPUT"
echo "::notice::Commit message does not contain (sync): - skipping sync"
fi
sync:
needs: check-sync
if: needs.check-sync.outputs.should_sync == 'true'
runs-on: ubuntu-latest
steps:
- name: Trigger downstream workflow via gh
env:
GH_TOKEN: ${{ secrets.CHANGELOG_PAT }}
run: |
gh workflow run sync-code-snippets.yml \
--repo codesnippetspro/.github-private --ref main \
--field caller_repo="${{ github.repository }}" \
--field caller_ref="${{ github.ref_name }}" \
--field commit_sha="${{ github.sha }}"
echo "::notice::Dispatched sync workflow"