|
3 | 3 | schedule: |
4 | 4 | - cron: "0 * * * *" |
5 | 5 | workflow_dispatch: |
6 | | - inputs: |
7 | | - test_label_regexp: |
8 | | - required: false |
9 | | - type: string |
| 6 | +concurrency: |
| 7 | + group: ${{ github.workflow }} |
| 8 | + cancel-in-progress: true |
| 9 | +env: |
| 10 | + REPO: ${{ github.repository }} |
| 11 | + TOKEN: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }} |
10 | 12 | jobs: |
11 | | - build: |
| 13 | + sync: |
12 | 14 | runs-on: ubuntu-latest |
13 | 15 | steps: |
14 | | - - uses: actions/checkout@v3 |
15 | | - with: |
16 | | - ref: cmakebuild |
17 | 16 | - name: Sync |
18 | 17 | run: | |
19 | | - git checkout main -- ydb/ci/sync_cmakebuild.sh |
20 | | - cp ydb/ci/sync_cmakebuild.sh ~ |
21 | | - git restore ydb/ci/sync_cmakebuild.sh |
22 | | - ~/sync_cmakebuild.sh |
23 | | - git push |
| 18 | + mainsha=$(curl -s -H "Accept: application/vnd.github.VERSION.sha" https://api.github.com/repos/$REPO/commits/main) |
| 19 | + echo "Main sha: ${mainsha}" |
| 20 | + lastsha=$(curl -s https://raw.githubusercontent.com/$REPO/cmakebuild/ydb/ci/cmakegen.txt) |
| 21 | + echo "Last sha: ${lastsha}" |
| 22 | + if [ ${mainsha} == ${lastsha} ];then |
| 23 | + echo "No new commits on the main branch to merge, exiting" |
| 24 | + exit 0 |
| 25 | + fi |
| 26 | + git clone -b main --shallow-exclude cmakebuild https://$TOKEN@github.com/$REPO.git ydb |
| 27 | + git config --global user.email "alex@ydb.tech" |
| 28 | + git config --global user.name "Alexander Smirnov" |
| 29 | + cd ydb |
| 30 | + git fetch --depth `expr $(git rev-list --count HEAD) + 1` |
| 31 | + git fetch origin cmakebuild:cmakebuild --depth 3 # 1st with cmake generation, 2nd with previous merge, 3rd is common between main and cmakebuild |
| 32 | + mainsha=$(git rev-parse HEAD) |
| 33 | + git checkout cmakebuild |
| 34 | + prevsha=$(git rev-parse HEAD) |
| 35 | + git merge main --no-edit |
| 36 | + currsha=$(git rev-parse HEAD) |
| 37 | + if [ ${prevsha} == ${currsha} ];then |
| 38 | + echo "Merge did not bring any changes, exiting" |
| 39 | + exit |
| 40 | + fi |
| 41 | + ./generate_cmake -k |
| 42 | + echo ${mainsha} > ydb/ci/cmakegen.txt |
| 43 | + git add . |
| 44 | + git commit -m "Generate cmake for ${mainsha}" |
| 45 | + git push --set-upstream origin cmakebuild |
0 commit comments