From b53f1525d34dddeafa08df48b4df8c576c29eb2a Mon Sep 17 00:00:00 2001 From: Alexander Stein Date: Thu, 5 May 2022 20:05:50 -0400 Subject: [PATCH] Boolean handling workaround for workflow_call vs workflow_dispatch bug. This fix will resolve the issue noticed in the runs post release prep. https://github.com/usnistgov/OSCAL/runs/6311164174 https://github.com/usnistgov/OSCAL/runs/6311163976 This is a workaround report in this thread. https://github.com/github/feedback/discussions/9343#discussion-3768151 It pertains to this issue, which has yet to be fixed in GitHub Actions runners that exhibit a difference in behavior for the same boolean input being treated as a string in a `workflow_dispatch` `inputs` (i.e. `github.event.inputs.*`) even if `type: boolean` is set but behaves properly as intended for `workflow_call` `inputs` (`inputs.*` which are different in the object graph) and treated as bools through and through. This is reported in actions/runner#1483. To resolve this, the buggy `workflow_dispatch` `github.event.inputs.*` will be left with the workaround as-is, conditional checking the values as strings, but we revert the changes for `workflow_call` `inputs.*` and leave them like before until actions/runner#1483 is resolved. --- .../workflows/workflow-generate-metaschema-resources.yml | 4 ++-- .github/workflows/workflow-generate-website-reference.yml | 4 ++-- .github/workflows/workflow-generate-website.yml | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/workflow-generate-metaschema-resources.yml b/.github/workflows/workflow-generate-metaschema-resources.yml index ab766adeb0..1d84484bc8 100644 --- a/.github/workflows/workflow-generate-metaschema-resources.yml +++ b/.github/workflows/workflow-generate-metaschema-resources.yml @@ -53,7 +53,7 @@ jobs: id: checkout_latest_workflow # use this for builds triggered from other workflows on protected branches - name: Checkout Latest (using access_token) - if: github.event_name == 'push' && inputs.commit_resources == 'true' + if: github.event_name == 'push' && inputs.commit_resources == true uses: actions/checkout@v3 with: path: ${{ env.CHECKOUT_PATH }} @@ -131,7 +131,7 @@ jobs: # --------------- - name: Publish Schemas and Converters # only do this on master - if: github.event.inputs.commit_resources == 'true' || inputs.commit_resources == 'true' + if: github.event.inputs.commit_resources == 'true' || inputs.commit_resources == true uses: stefanzweifel/git-auto-commit-action@v4.9.2 with: repository: ${{ env.CHECKOUT_PATH }} diff --git a/.github/workflows/workflow-generate-website-reference.yml b/.github/workflows/workflow-generate-website-reference.yml index 8de660c561..27f61c238d 100644 --- a/.github/workflows/workflow-generate-website-reference.yml +++ b/.github/workflows/workflow-generate-website-reference.yml @@ -91,7 +91,7 @@ jobs: id: checkout_main_workflow # use this for builds triggered from other workflows on protected branches - name: Checkout Main (using access_token) - if: github.event_name == 'push' && inputs.commit_resources == 'true' + if: github.event_name == 'push' && inputs.commit_resources == true uses: actions/checkout@v3 with: path: ${{ env.MAIN_PATH }} @@ -167,7 +167,7 @@ jobs: retention-days: 5 - name: Publish Generated Pages # only do this on master - if: github.event.inputs.commit_resources == 'true' || inputs.commit_resources == 'true' + if: github.event.inputs.commit_resources == 'true' || inputs.commit_resources == true uses: stefanzweifel/git-auto-commit-action@v4.9.2 with: repository: ${{ env.MAIN_PATH }} diff --git a/.github/workflows/workflow-generate-website.yml b/.github/workflows/workflow-generate-website.yml index 26860c8173..15226911b1 100644 --- a/.github/workflows/workflow-generate-website.yml +++ b/.github/workflows/workflow-generate-website.yml @@ -83,7 +83,7 @@ jobs: id: checkout_latest_workflow # use this for builds triggered from other workflows on protected branches - name: Checkout Latest (using access_token) - if: github.event_name == 'push' && inputs.commit_resources == 'true' + if: github.event_name == 'push' && inputs.commit_resources == true uses: actions/checkout@v3 with: token: ${{ secrets.access_token }} @@ -163,13 +163,13 @@ jobs: script: | core.setFailed('Link checker detected broken or invalid links, read attached report.') - uses: actions/github-script@v3 # current: f05a81df23035049204b043b50c3322045ce7eb3 - if: steps.linkchecker.outputs.exit_code != 0 && (github.event.inputs.bad_links_fail_build == 'true' || inputs.bad_links_fail_build == 'true') + if: steps.linkchecker.outputs.exit_code != 0 && (github.event.inputs.bad_links_fail_build == 'true' || inputs.bad_links_fail_build == true) with: script: | core.setFailed('Link checker detected broken or invalid links, read attached report.') - name: Deploy Website (using access_token) uses: peaceiris/actions-gh-pages@068dc23d9710f1ba62e86896f84735d869951305 # current: v3 - if: github.event_name == 'push' && inputs.commit_resources == 'true' && github.ref_name == 'main' + if: github.event_name == 'push' && inputs.commit_resources == true && github.ref_name == 'main' with: github_token: ${{ secrets.access_token }} enable_jekyll: false