|
7 | 7 | workflow_dispatch: |
8 | 8 |
|
9 | 9 | jobs: |
10 | | - push-subtree: |
| 10 | + sync-to-suite: |
11 | 11 | runs-on: ubuntu-latest |
12 | 12 | steps: |
13 | | - - name: Checkout repo figlia |
14 | | - uses: actions/checkout@v4 |
15 | | - with: |
16 | | - fetch-depth: 0 |
17 | | - |
18 | | - - name: Exit if commit is from bot |
19 | | - run: | |
20 | | - AUTHOR=$(git log -1 --pretty=format:'%an') |
21 | | - if [[ "$AUTHOR" == "github-actions[bot]" ]]; then |
22 | | - echo "Last commit was made by bot, exiting." |
23 | | - exit 0 |
24 | | - fi |
25 | | -
|
26 | | - - name: Setup SSH |
27 | | - uses: webfactory/ssh-agent@v0.9.1 |
28 | | - with: |
29 | | - ssh-private-key: ${{ secrets.QUERY_ENGINE_SUITE_KEY }} |
30 | | - |
31 | | - - name: Set Git user |
32 | | - run: | |
33 | | - git config user.name "github-actions[bot]" |
34 | | - git config user.email "github-actions[bot]@users.noreply.github.com" |
35 | | -
|
36 | | - - name: Set branch name |
37 | | - run: echo "BRANCH_NAME=${GITHUB_REF#refs/heads/}" >> $GITHUB_ENV |
38 | | - |
39 | | - - name: Add padre remote |
40 | | - run: git remote add qe-suite-remote git@github.com:OPSILab/query-engine-suite.git || echo "Remote already exists" |
41 | | - |
42 | | - - name: Pull latest from subtree |
43 | | - run: | |
44 | | - git subtree pull --prefix=Query-Engine qe-suite-remote ${{ env.BRANCH_NAME }} --squash || echo "No changes to pull" |
45 | | -
|
46 | | - - name: Push subtree / create branch if needed |
47 | | - run: | |
48 | | - git subtree split --prefix=Query-Engine -b tmp-subtree |
49 | | -
|
50 | | - if git ls-remote --heads qe-suite-remote ${{ env.BRANCH_NAME }} | grep -q ${{ env.BRANCH_NAME }}; then |
51 | | - echo "Branch exists on remote, pushing subtree..." |
52 | | - git push qe-suite-remote tmp-subtree:${{ env.BRANCH_NAME }} |
53 | | - else |
54 | | - echo "Branch does not exist on remote, creating branch..." |
55 | | - git push qe-suite-remote tmp-subtree:refs/heads/${{ env.BRANCH_NAME }} |
56 | | - fi |
57 | | -
|
58 | | - git branch -D tmp-subtree |
| 13 | + - name: Trigger sync on parent repo |
| 14 | + run: | |
| 15 | + curl -X POST \ |
| 16 | + -H "Accept: application/vnd.github+json" \ |
| 17 | + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ |
| 18 | + https://api.github.com/repos/OPSILab/query-engine-suite/dispatches \ |
| 19 | + -d '{"event_type":"sync-query-engine"}' |
0 commit comments