diff --git a/.github/actions/is-defined/action.yaml b/.github/actions/is-defined/action.yaml new file mode 100644 index 0000000000..4f11f55633 --- /dev/null +++ b/.github/actions/is-defined/action.yaml @@ -0,0 +1,21 @@ +name: Checks if an input is defined + +description: Checks if an input is defined and outputs 'true' or 'false'. + +inputs: + value: + description: value to test + required: true + +outputs: + result: + description: outputs 'true' or 'false' if input value is defined or not + value: ${{ steps.check.outputs.result }} + +runs: + using: composite + steps: + - shell: bash + id: check + run: | + echo "result=${{ inputs.value != '' }}" >> $GITHUB_OUTPUT diff --git a/.github/workflows/pr-update.yaml b/.github/workflows/pr-update.yaml index 4cff14021b..525d310544 100644 --- a/.github/workflows/pr-update.yaml +++ b/.github/workflows/pr-update.yaml @@ -7,8 +7,20 @@ on: - 'release-*' jobs: + checksecret: + runs-on: ubuntu-latest + outputs: + result: ${{ steps.check.outputs.result }} + steps: + - name: Check secret + id: check + uses: ./.github/actions/is-defined + with: + value: ${{ secrets.PR_UPDATE_TOKEN }} + autoupdate: - if: ${{ secrets.PR_UPDATE_TOKEN }} + needs: [checksecret] + if: needs.checksecret.outputs.result == 'true' permissions: pull-requests: write runs-on: ubuntu-latest