From d845f9ae43afa85b5b7e1c7e2e2cf06d831b8c4d Mon Sep 17 00:00:00 2001 From: Thomas Evans <76004952+tevans-submittable@users.noreply.github.com> Date: Fri, 11 Feb 2022 10:36:04 -0500 Subject: [PATCH 1/3] Provide example of boolean input usage Many people are confused by the usage of boolean. https://github.com/actions/runner/issues/1483 invalid if: ${{ inputs.perform_deploy }} if: inputs.perform_deploy Must be treated as string --- content/actions/learn-github-actions/contexts.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/content/actions/learn-github-actions/contexts.md b/content/actions/learn-github-actions/contexts.md index ffad10c4e104..cd083f13a1da 100644 --- a/content/actions/learn-github-actions/contexts.md +++ b/content/actions/learn-github-actions/contexts.md @@ -762,10 +762,14 @@ on: deploy_target: required: true type: string + perform_deploy: + required: true + type: boolean jobs: deploy: runs-on: ubuntu-latest + if: ${{ inputs.perform_deploy == 'true' }} steps: - name: Deploy build to target run: deploy --build ${{ inputs.build_id }} --target ${{ inputs.deploy_target }} From a6bd350ed65de7d351e4f66f73ab9a7c1d6971b2 Mon Sep 17 00:00:00 2001 From: Thomas Evans <76004952+tevans-submittable@users.noreply.github.com> Date: Fri, 11 Feb 2022 10:53:47 -0500 Subject: [PATCH 2/3] Update another example --- .../reusables/github-actions/workflow-dispatch-inputs.md | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/data/reusables/github-actions/workflow-dispatch-inputs.md b/data/reusables/github-actions/workflow-dispatch-inputs.md index f7de2293a50c..e0b97ae89431 100644 --- a/data/reusables/github-actions/workflow-dispatch-inputs.md +++ b/data/reusables/github-actions/workflow-dispatch-inputs.md @@ -17,7 +17,11 @@ on: - debug {% endif %} tags: description: 'Test scenario tags' - required: false {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %} + required: true {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %} + type: string + print_tags: + description: 'True to print to STDOUT' + required: true {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %} type: boolean environment: description: 'Environment to run tests against' @@ -30,5 +34,6 @@ jobs: steps: - name: Print the input tag to STDOUT - run: echo {% raw %} The tag is ${{ github.event.inputs.tag }} {% endraw %} + if: {% raw %} ${{ github.event.inputs.tags == 'true' }} {% endraw %} + run: echo {% raw %} The tag is ${{ github.event.inputs.tags }} {% endraw %} ``` From 99b4fa1cc169da743671332897e289376016d2c4 Mon Sep 17 00:00:00 2001 From: Thomas Evans <76004952+tevans-submittable@users.noreply.github.com> Date: Fri, 11 Feb 2022 11:00:53 -0500 Subject: [PATCH 3/3] linting fix --- data/reusables/github-actions/workflow-dispatch-inputs.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/data/reusables/github-actions/workflow-dispatch-inputs.md b/data/reusables/github-actions/workflow-dispatch-inputs.md index e0b97ae89431..1960a988087b 100644 --- a/data/reusables/github-actions/workflow-dispatch-inputs.md +++ b/data/reusables/github-actions/workflow-dispatch-inputs.md @@ -15,14 +15,14 @@ on: - info - warning - debug {% endif %} + print_tags: + description: 'True to print to STDOUT' + required: true {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %} + type: boolean {% endif %} tags: description: 'Test scenario tags' required: true {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %} type: string - print_tags: - description: 'True to print to STDOUT' - required: true {% ifversion fpt or ghec or ghes > 3.3 or ghae-issue-5511 %} - type: boolean environment: description: 'Environment to run tests against' type: environment