feat(workflows): add reusable Docusaurus workflow (DX-2760)#1398
feat(workflows): add reusable Docusaurus workflow (DX-2760)#1398
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>
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
e4a32e6 to
4575245
Compare
| - uses: actions/checkout@v6 | ||
|
|
||
| - name: Setup nodejs | ||
| uses: smartcontractkit/.github/actions/setup-nodejs@setup-nodejs/v1 |
Check warning
Code scanning / CodeQL
Unpinned tag for a non-immutable Action in workflow Medium
There was a problem hiding this comment.
@chainchad we need to write the custom config to skip those findings for internal actions.
…rectory with pnpm -C Co-authored-by: Cursor <cursoragent@cursor.com>
…g validates docs) Co-authored-by: Cursor <cursoragent@cursor.com>
…ain) Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve modify/delete conflicts: keep removal of actions/docs-deploy and actions/docs-test (replaced by reusable workflow). Co-authored-by: Cursor <cursoragent@cursor.com>
| deployment-branch: | ||
| description: "branch to deploy to (e.g., gh-pages)" | ||
| required: false | ||
| type: string | ||
| default: "gh-pages" |
| github-event-name: | ||
| description: "the GitHub event name that triggered the calling workflow (e.g., push, pull_request, merge_group)" | ||
| required: false | ||
| type: string | ||
| default: "workflow_call" | ||
| github-ref: | ||
| description: "the GitHub ref that triggered the calling workflow (e.g., refs/heads/main)" | ||
| required: false | ||
| type: string | ||
| default: "" |
There was a problem hiding this comment.
I believe these are already available from the original calling context. So they aren't needed as inputs.
For example: https://github.com/smartcontractkit/releng-test/actions/runs/21961260549/job/63439049182?pr=159
# https://github.com/smartcontractkit/releng-test/actions/runs/21961366180/job/63439420326#step:3:44
GITHUB_REF=refs/heads/main
# https://github.com/smartcontractkit/releng-test/actions/runs/21961366180/job/63439420326#step:3:91
GITHUB_REF_NAME=main
# https://github.com/smartcontractkit/releng-test/actions/runs/21961366180/job/63439420326#step:3:61
GITHUB_EVENT_NAME=push
These are accessible as env vars or like:
${{ github.event_name }}${{ github.ref_name }}- etc...
| uses: actions/upload-pages-artifact@v4.0.0 | ||
| with: | ||
| path: >- | ||
| ${{ inputs.package-json-directory }}/${{ inputs.build-output-directory }} |
There was a problem hiding this comment.
I don't think this should include package-json-directory.
The path can be relative to the repository root as the other inputs, or can be an absolute path if they are outputting to /tmp for example.
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.