From 2d3c47df85ad5abfb6b062a9f2964fbf3e5d9286 Mon Sep 17 00:00:00 2001 From: jacobrein Date: Fri, 27 Dec 2024 12:23:10 -0700 Subject: [PATCH] Refactor: Update nightly release workflow to use outputs This commit refactors the nightly release workflow to use outputs to determine if subsequent jobs should run, instead of relying on environment variables. - The `checkNightly` job now has an output called `shouldRun` that indicates if there are new commits. - Subsequent jobs now utilize `needs.checkNightly.outputs.shouldRun` instead of `env.NEW_COMMIT_COUNT` to determine their execution condition. --- .github/workflows/nightly_release.yaml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/nightly_release.yaml b/.github/workflows/nightly_release.yaml index ecc05f50..6a9f37fc 100644 --- a/.github/workflows/nightly_release.yaml +++ b/.github/workflows/nightly_release.yaml @@ -10,6 +10,8 @@ jobs: checkNightly: name: Check for new commits runs-on: ubuntu-latest + outputs: + shouldRun: ${{ env.NEW_COMMIT_COUNT > 0 }} steps: - name: Checkout uses: actions/checkout@v4 @@ -22,32 +24,32 @@ jobs: mangaworld: needs: checkNightly - if: ${{ env.NEW_COMMIT_COUNT > 0 }} + if: ${{ needs.checkNightly.outputs.shouldRun == 'true' }} uses: ./.github/workflows/mangaworld_build.yaml secrets: inherit # pass all secrets animeworld: needs: checkNightly - if: ${{ env.NEW_COMMIT_COUNT > 0 }} + if: ${{ needs.checkNightly.outputs.shouldRun == 'true' }} uses: ./.github/workflows/animeworld_build.yaml secrets: inherit # pass all secrets animeworldtv: needs: checkNightly - if: ${{ env.NEW_COMMIT_COUNT > 0 }} + if: ${{ needs.checkNightly.outputs.shouldRun == 'true' }} uses: ./.github/workflows/animeworldtv_build.yaml secrets: inherit # pass all secrets novelworld: needs: checkNightly - if: ${{ env.NEW_COMMIT_COUNT > 0 }} + if: ${{ needs.checkNightly.outputs.shouldRun == 'true' }} uses: ./.github/workflows/novelworld_build.yaml secrets: inherit # pass all secrets release: name: Release APK needs: [ mangaworld, animeworld, novelworld, animeworldtv ] - if: ${{ env.NEW_COMMIT_COUNT > 0 }} + if: ${{ needs.checkNightly.outputs.shouldRun == 'true' }} runs-on: ubuntu-latest steps: