-
Notifications
You must be signed in to change notification settings - Fork 1.8k
41 lines (38 loc) · 1.26 KB
/
ci-sync.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
name: SYNC PIPELINE
on:
pull_request_target:
branches:
- main
- 'branch-[0-9].[0-9]*'
types:
- closed
workflow_dispatch:
jobs:
sync:
runs-on: [self-hosted, sync]
if: github.event.pull_request.merged == true && github.repository == 'StarRocks/starrocks'
env:
PR_NUMBER: ${{ github.event.number }}
GH_TOKEN: ${{ secrets.PAT2 }}
steps:
- name: commit_sha
id: commit_sha
run: |
set -x
pr_info=$(gh pr view ${PR_NUMBER} -R ${{ github.repository }} --json mergeCommit,labels)
labels=`echo $pr_info | jq -r '.labels[].name'`
if [[ "${labels}" =~ sync ]]; then
echo "is_sync=true" >> $GITHUB_OUTPUT
else
commit_sha=`echo $pr_info | jq -r '.mergeCommit.oid'`
echo "commit_sha=${commit_sha:0:7}" >> $GITHUB_OUTPUT
fi
- name: sync
if: steps.commit_sha.outputs.is_sync != 'true'
env:
PR_ID: ${{ github.event.number }}
COMMIT_ID: ${{ steps.commit_sha.outputs.commit_sha }}
BRANCH: ${{ github.base_ref }}
run: |
rm -rf ./ci-tool && cp -rf /var/lib/ci-tool ./ci-tool && cd ci-tool && git pull >/dev/null
./scripts/run-repo-sync.sh