Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the dry-run flag behaviour #5

Merged
merged 6 commits into from
Nov 18, 2024
Merged

Fix the dry-run flag behaviour #5

merged 6 commits into from
Nov 18, 2024

Conversation

johnbillion
Copy link
Owner

See #4.

Still needs more work.

action.yml Outdated
@@ -80,14 +80,14 @@ runs:
shell: bash

- name: Generate attestation for the plugin
if: ${{ ! inputs.dry-run }}
if: ${{ inputs.dry-run == false }}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would write != true

@szepeviktor
Copy link
Contributor

@szepeviktor
Copy link
Contributor

szepeviktor commented Nov 18, 2024

You can always add a temporary debug step

run: echo dry-run=${{ toJSON(inputs.dry-run) }}
# or
run: echo inputs=${{ toJSON(inputs) }}

@johnbillion
Copy link
Owner Author

@szepeviktor What am I doing wrong? This run has the dry-run input set to true but the steps with the if conditions still ran: https://github.com/johnbillion/user-switching/actions/runs/11891945602/job/33133767062 .

The input values can be seen at the top by expanding the arrow next to Run johnbillion/action-wordpress-plugin-attestation@dry-run:

Run johnbillion/action-wordpress-plugin-attestation@dry-run
  with:
    version: 1.8.0
    zip-path: /home/runner/work/user-switching/user-switching/user-switching.zip
    dry-run: true
    plugin: user-switching
    timeout: 60

@szepeviktor
Copy link
Contributor

Try that debug step!

@johnbillion
Copy link
Owner Author

johnbillion commented Nov 18, 2024

Oh the value is being set to string "true" instead of a boolean.

"Inputs: {
    "version": "1.8.0",
    "zip-path": "/home/runner/work/user-switching/user-switching/user-switching.zip",
    "dry-run": "true",
    "plugin": "user-switching",
    "timeout": "60"
}"

@szepeviktor
Copy link
Contributor

actions/runner#1483 (comment) 👀

@johnbillion
Copy link
Owner Author

Yep that looks correct. Inputs for actions are strings only: https://stackoverflow.com/a/76294014

@johnbillion
Copy link
Owner Author

Okay we're looking good now. What a pickle.

@szepeviktor
Copy link
Contributor

szepeviktor commented Nov 18, 2024

Actually echo " hides quotation marks in the JSON.

printf 'Inputs = '
cat <<"GITHUB__CONTEXT"
${{ toJSON(inputs) }}
GITHUB__CONTEXT

source

@johnbillion
Copy link
Owner Author

It shows up correctly when you expand the > next to the command, but yeah the output is not clear.

@johnbillion
Copy link
Owner Author

Single quotes save the day.

@johnbillion johnbillion merged commit a16e559 into trunk Nov 18, 2024
@johnbillion johnbillion deleted the dry-run branch November 18, 2024 12:34
@johnbillion
Copy link
Owner Author

Thanks for the assistance @szepeviktor 💪

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants