1
0
Fork 0
mirror of https://github.com/kyverno/kyverno.git synced 2024-12-14 11:57:48 +00:00

fix: condition jobs in gh actions (#5925)

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>

Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
This commit is contained in:
Charles-Edouard Brétéché 2023-01-06 18:28:15 +01:00 committed by GitHub
parent bb6005a7a3
commit ae1d210319
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 34 additions and 1 deletions

21
.github/actions/is-defined/action.yaml vendored Normal file
View file

@ -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

View file

@ -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