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 Echidna dry-run logic #1857

Merged
merged 2 commits into from
Dec 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/workflows/w3c-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,10 @@ jobs:
W3C_ECHIDNA_TOKEN_CORE: ${{ secrets.W3C_ECHIDNA_TOKEN_CORE }}
W3C_ECHIDNA_TOKEN_JSAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_JSAPI }}
W3C_ECHIDNA_TOKEN_WEBAPI: ${{ secrets.W3C_ECHIDNA_TOKEN_WEBAPI }}
# Publish the draft on manual dispatches without dry-run set, or on pushes to the main branch.
ECHIDNA_DRYRUN: |-
${{ (github.event_name == 'workflow_dispatch' && inputs.dry-run) ||
!(github.event_name == 'push' && github.repository == 'WebAssembly/spec' && github.ref == 'refs/heads/main') }}
${{ !((github.event_name == 'workflow_dispatch' && !inputs.dry-run) ||
(github.event_name == 'push' && github.repository == 'WebAssembly/spec' && github.ref == 'refs/heads/main')) }}
Comment on lines +69 to +70
Copy link
Member

Choose a reason for hiding this comment

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

I think this is slightly clearer if we distribute the ! a bit:

Suggested change
${{ !((github.event_name == 'workflow_dispatch' && !inputs.dry-run) ||
(github.event_name == 'push' && github.repository == 'WebAssembly/spec' && github.ref == 'refs/heads/main')) }}
${{ (github.event_name != 'workflow_dispatch' || inputs.dry-run) &&
!(github.event_name == 'push' && github.repository == 'WebAssembly/spec' && github.ref == 'refs/heads/main')) }}

Copy link
Member Author

Choose a reason for hiding this comment

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

Maybe. It's written like this because dry-run is already "inverted", and it was easier to think of it as "publish for real if these conditions are met". Another option is to actually reflect that in the variable name in this file, and then invert it when passing through to echidna's curl request as dry-run status. The downside of that is that we'd have to do the logic inversion of "true" to "false" in Makefile shell syntax, which seems worse than doing it in the GH script syntax here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I added a comment. If you still think this suggestion is better, I don't really mind switching it.

- name: Validate ${{ matrix.spec }} spec with Echidna
if: env.W3C_USERNAME
run: cd document && make -e -C ${{ matrix.spec }} WD-echidna
Expand Down
Loading