From 88e6164147c2b25ddc1053bbd01d9ac31549ac97 Mon Sep 17 00:00:00 2001 From: Alexander Koz Date: Tue, 16 Apr 2024 20:37:43 +0400 Subject: [PATCH] CI: fix bump after update --- .github/workflows/update.yml | 46 +++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/.github/workflows/update.yml b/.github/workflows/update.yml index cea3db10..9ac2450f 100644 --- a/.github/workflows/update.yml +++ b/.github/workflows/update.yml @@ -131,7 +131,8 @@ jobs: echo "Base branch: ${{ needs.new-branch.outputs.base }}" echo "Working branch: ${{ needs.new-branch.outputs.working }}" - - uses: actions/checkout@v4 + - name: Checkout + uses: actions/checkout@v4 with: ref: ${{ needs.new-branch.outputs.working }} @@ -224,11 +225,49 @@ jobs: echo "Pushed: ${{ steps.commit.outputs.pushed }}" echo "SHA: ${{ steps.commit.outputs.commit_sha }}" + changes: + name: Changes + needs: [new-branch, pre-gen] + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + ref: ${{ needs.new-branch.outputs.working }} + fetch-depth: 10 + + # Maybe better just checkout and then + # git rev-list --ancestry-path ${{ needs.new-branch.outputs.base || github.event.repository.default_branch }}..${{ needs.new-branch.outputs.working }} + # It's faster, simplier and less deps. + - name: Changes + id: changes + continue-on-error: true + uses: tj-actions/changed-files@v44 + with: + skip_initial_fetch: "false" + sha: ${{ needs.new-branch.outputs.working }} + base_sha: ${{ needs.new-branch.outputs.base || github.event.repository.default_branch }} + + - name: List changed files + if: steps.changes.outcome == 'success' + env: + ALL_CHANGED_FILES: ${{ steps.changes.outputs.all_changed_files }} + run: | + for file in ${ALL_CHANGED_FILES}; do + echo "$file was changed" + done + + outputs: + changes: ${{ steps.changes.outputs.all_changed_files }} + changed: ${{ steps.changes.outputs.all_changed_files && 'true' || ' ' }} + + bump: name: Bump - needs: [new-branch, pre-gen] + needs: [new-branch, pre-gen, changes] runs-on: ubuntu-latest continue-on-error: true # Workspaces are not supported yet + if: needs.changes.outputs.changed == 'true' defaults: run: shell: bash @@ -307,7 +346,8 @@ jobs: tests: name: Tests - needs: [new-branch, pre-gen] + needs: [new-branch, pre-gen, changes] + if: needs.changes.outputs.changed == 'true' uses: ./.github/workflows/tests.yml secrets: inherit permissions: