ci(publish-docs.yml): add manual trigger to workflow#3707
Conversation
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the 📝 WalkthroughWalkthroughAdded a manual Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Dev as Developer (manual)
participant GH as GitHub Actions
participant WF as publish-docs workflow
participant Jobs as Jobs (build/publish/post-PR)
Dev->>GH: Trigger workflow_dispatch (version, forcePush)
GH->>WF: Start workflow (workflow_dispatch) or (workflow_call)
WF->>Jobs: Evaluate job/step if-conditions
alt buildOnly == true
Jobs->>Jobs: Run build-only job (no publish)
else buildOnly != true
Jobs->>Jobs: Run build + publish
alt linkToPR == true
Jobs->>Jobs: Post docs link to PR
end
end
Note right of Jobs: DOCS_VERSION and FORCE_PUSH resolved from inputs OR github.event.inputs (fallbacks)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Pre-merge checks and finishing touches✅ Passed checks (3 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Documentation has been published to https://lundalogik.github.io/lime-elements/versions/PR-3707/ |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
.github/workflows/publish-docs.yml (1)
48-53: Make conditions and env compatible with both workflow_call and workflow_dispatch
- In the “Publish docs” step, update to coalesce inputs and always run on manual dispatch:
- if: inputs.buildOnly != true + if: inputs.buildOnly != true || github.event_name == 'workflow_dispatch' env: - DOCS_VERSION: ${{ inputs.version }} - FORCE_PUSH: ${{ inputs.forcePush }} + DOCS_VERSION: ${{ inputs.version || github.event.inputs.version }} + FORCE_PUSH: ${{ inputs.forcePush || github.event.inputs.forcePush || 'false' }} GH_TOKEN: ${{ secrets.PUBLISH_DOCS }}- Gate the “Build docs, but do not publish” step:
- if: inputs.buildOnly + if: inputs.buildOnly && github.event_name != 'workflow_dispatch'- Gate the
link-docsjob:- if: inputs.buildOnly != true && inputs.linkToPR == true + if: (inputs.buildOnly != true && inputs.linkToPR == true) && github.event_name == 'workflow_call'
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: ASSERTIVE
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/publish-docs.yml(3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Docs / Publish Docs
- GitHub Check: Test
- GitHub Check: Build
🔇 Additional comments (1)
.github/workflows/publish-docs.yml (1)
64-64: Remove unnecessary event_name guard Thelink-docsjob already requiresinputs.linkToPR == true, and on a manualworkflow_dispatchruninputs.linkToPRis undefined (or false), so the job never runs without addinggithub.event_namecheck.Likely an incorrect or invalid review comment.
| workflow_dispatch: | ||
| inputs: | ||
| version: | ||
| description: 'The "name" of the version to be published. IMPORTANT: This only _names_ the published docs, it does not affect what is actually published. This workflow always builds and publishes the docs for whatever is the latest in the branch on which it is run.' | ||
| required: true | ||
| type: string | ||
| forcePush: | ||
| description: 'Pass `true` if git push should use `--force`.' | ||
| required: false | ||
| default: false | ||
| type: boolean | ||
|
|
There was a problem hiding this comment.
Manual trigger added, but inputs context mismatch will break manual runs
This workflow still reads inputs.* (reusable-workflow context) for conditions and env. Under workflow_dispatch, values are under github.event.inputs. Without fallback, DOCS_VERSION/forcePush resolve empty and if conditions may error/misfire. Address by coalescing to github.event.inputs and guarding conditions by event_name.
🤖 Prompt for AI Agents
.github/workflows/publish-docs.yml lines 24-35: the manual trigger added exposes
inputs under github.event.inputs but the workflow still reads reusable-workflow
inputs.* causing DOCS_VERSION and forcePush to be empty or conditionals to
misfire; update the workflow to coalesce values from github.event.inputs when
github.event_name == 'workflow_dispatch' and otherwise fall back to inputs.*,
e.g. set env/vars using an expression that checks github.event_name ==
'workflow_dispatch' ? github.event.inputs.<name> : inputs.<name> (and provide
sensible defaults), and wrap any conditional checks with github.event_name
guards so conditions referencing github.event.inputs are only evaluated for
workflow_dispatch events.
There was a problem hiding this comment.
@coderabbitai Has this been appropriately addressed in the fixup commit? (d47d87b)
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Fetch the specific commit to see what changes were made
git show d47d87bc3e1e3ab83b5c76156f43bc310cee8488
Length of output: 1631
@adrianschmidt The environment variable coalescing has been correctly addressed! The expressions ${{ inputs.version || github.event.inputs.version }} and ${{ inputs.forcePush || github.event.inputs.forcePush || 'false' }} will properly resolve values from both workflow_call and workflow_dispatch contexts.
However, there's a critical issue with the conditional logic: The "Publish docs" step now has this condition:
if: github.event_name == 'workflow_call' && inputs.buildOnly == falseThis condition will prevent the workflow from publishing docs when manually triggered via workflow_dispatch, because github.event_name will be 'workflow_dispatch', not 'workflow_call'. The step will simply be skipped.
Recommended fix:
- name: Publish docs
if: github.event_name == 'workflow_dispatch' || (github.event_name == 'workflow_call' && inputs.buildOnly == false)
env:
DOCS_VERSION: ${{ inputs.version || github.event.inputs.version }}
FORCE_PUSH: ${{ inputs.forcePush || github.event.inputs.forcePush || 'false' }}
GH_TOKEN: ${{ secrets.PUBLISH_DOCS }}
run: |
if [ "$FORCE_PUSH" = "true" ]; then
npm run docs:publish -- --v="$DOCS_VERSION" --forcePush
else
npm run docs:publish -- --v="$DOCS_VERSION"
fiThis way:
- Manual triggers (
workflow_dispatch) will always publish - Reusable workflow calls (
workflow_call) will only publish whenbuildOnlyisfalse
There was a problem hiding this comment.
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
# Fetch the specific commit to verify the fix
git show a8e92a2d5
Length of output: 945
@adrianschmidt Perfect! ✅ The fix in commit a8e92a2 correctly addresses the issue. The updated condition:
if: github.event_name == 'workflow_dispatch' || inputs.buildOnly == falseNow properly handles both scenarios:
- Manual triggers (
workflow_dispatch): Will always publish docs - Reusable workflow calls (
workflow_call): Will publish only whenbuildOnly == false
The workflow is now fully functional for both manual and automated invocations! 🎉
ヽ(^‿^)ノ
If you found this review helpful, would you consider giving us a shout-out on X?
Thank you for using CodeRabbit!
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
a8e92a2 to
753d078
Compare
|
🎉 This PR is included in version 38.29.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Summary by CodeRabbit
Review:
Browsers tested:
(Check any that applies, it's ok to leave boxes unchecked if testing something didn't seem relevant.)
Windows:
Linux:
macOS:
Mobile: