From 7678009f602276ee33bc01a79e9ca141f8ea241e Mon Sep 17 00:00:00 2001 From: ColorfulRhino <131405023+ColorfulRhino@users.noreply.github.com> Date: Thu, 15 Aug 2024 23:31:43 +0200 Subject: [PATCH] actions: forked-helper: Run only if secret is set The workflow ran regardless whether `ARMBIAN_SELF_DISPATCH_TOKEN` was set or not, generating errors if the secret could not be found. In addition, simplify and beautify the workflow. --- .github/workflows/forked-helper.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/forked-helper.yml b/.github/workflows/forked-helper.yml index b00d7e5d95..5693e7e2a0 100644 --- a/.github/workflows/forked-helper.yml +++ b/.github/workflows/forked-helper.yml @@ -9,20 +9,18 @@ on: workflow_dispatch: jobs: - fork-repository-dispatch: - name: 📢 Run repository dispatch to default fork branch - if: ${{ github.repository_owner != 'armbian' }} + dispatch-on-forked-repo: + name: 📢 Run repository dispatch on fork + env: + DISPATCH_SECRET: ${{ secrets.ARMBIAN_SELF_DISPATCH_TOKEN }} + if: ${{ github.repository_owner != 'armbian' }} # Run only on forks runs-on: ubuntu-latest steps: - - name: Assign secret - id: get_dispatch_secret - run: echo "dispatch_secret=${{ secrets.ARMBIAN_SELF_DISPATCH_TOKEN }}" >> $GITHUB_OUTPUT - - - name: Dispatch event on forked repostitory - if: steps.get_dispatch_secret.outputs.dispatch_secret + - name: Dispatch event on forked repository + if: ${{ env.DISPATCH_SECRET != '' }} # Check that the secret has been set, if not, exit uses: peter-evans/repository-dispatch@v3 with: - token: ${{ steps.get_dispatch_secret.outputs.dispatch_secret }} + token: ${{ env.DISPATCH_SECRET }} repository: ${{ github.repository }} event-type: armbian client-payload: >