-
Notifications
You must be signed in to change notification settings - Fork 3
feat(workflows): add reusable Docusaurus workflow #1398
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
base: main
Are you sure you want to change the base?
Conversation
Convert docs-test and docs-deploy composite actions to reusable workflows for consistency with other .github workflows.
|
👋 sebawo, thanks for creating this pull request! To help reviewers, please consider creating future PRs as drafts first. This allows you to self-review and make any final changes before notifying the team. Once you're ready, you can mark it as "Ready for review" to request feedback. Thanks! |
…cusaurus Single reusable workflow with two jobs: docs-test (build + test) and docs-deploy (build + deploy to GitHub Pages). Deploy runs after test succeeds. Remove reusable-docs-test.yml and reusable-docs-deploy.yml.
Pin smartcontractkit/.github/actions/setup-nodejs to commit hash (43fe7fd) to resolve CodeQL unpinned-action warning.
Co-authored-by: chainchad <96362174+chainchad@users.noreply.github.com>
| working-directory: ${{ inputs.docs-directory }} | ||
| env: | ||
| BUILD_COMMAND: ${{ inputs.build-command }} | ||
| run: $BUILD_COMMAND |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should get rid of the first job, and just have one job since we have to build? We coudl run build and test in this job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chainchad good optimisation! fixed.
Remove actions/docs-test and actions/docs-deploy; Docusaurus build/test and deploy is now only via reusable-docusaurus.yml workflow. Remove docs-actions-minor changeset and update pnpm-lock.yaml.
Build once, then run test (if set), upload pages artifact, and deploy. Removes duplicate build and second job (docs-deploy).
Co-authored-by: chainchad <96362174+chainchad@users.noreply.github.com>
- reusable-docusaurus: add job-level permissions (contents, pages, id-token) and header comment documenting required permissions; no workflow-level perms - pull-request-main: add workflow-permissions-check job to fail when reusable workflows have non-empty workflow-level permissions
| id-token: write | ||
| steps: | ||
| - name: Checkout repo | ||
| if: inputs.checkout-repo == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should not be optional. We have it in actions because the calling job may or may not checkout the repo before calling the action.
Because this is a self-contained reusable workfow, these jobs are standalone and require a checkout.
| checkout-repo: | ||
| description: "enable git checkout repo" | ||
| required: false | ||
| type: string | ||
| default: "true" | ||
| checkout-repo-fetch-depth: | ||
| description: "number of commits to fetch" | ||
| required: false | ||
| type: string | ||
| default: "0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can delete these inputs. Checkout is no longer optional, and fetch depth seems like an unnecessary complexity.
|
|
||
| - name: Build documentation | ||
| shell: bash | ||
| working-directory: ${{ inputs.docs-directory }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be in the docs directory or the package.json directory?
Add a single reusable workflow for Docusaurus documentation: build, test (optional), and deploy to GitHub Pages. Remove the former composite actions in favor of the workflow only.
Changes
Added
docusaurus): checkout, setup Node.js (pinned ref), build docs, (optional) run tests, upload pages artifact, deploy to GitHub Pages. Build runs once; no duplicate jobs.Callers use one
workflow_callto run build, test, and deploy in a single job.Security
smartcontractkit/.github/actions/setup-nodejsto commit hash (setup-nodejs@0.2.3) to satisfy CodeQL unpinned-action requirement.Removed
Other
actions/docs-testandactions/docs-deployfrom lockfile.