refactor: streamline lint results handling in GitHub Actions workflow#154
refactor: streamline lint results handling in GitHub Actions workflow#154joshjohanning merged 1 commit intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request refactors the README linting workflow to improve compatibility with forked repositories by replacing PR comment posting with GitHub Actions job summaries. The change removes the complex artifact upload/download mechanism and the separate post-results job, opting instead for a simpler approach that displays lint results directly in the workflow job summary.
Changes:
- Removed artifact upload and download steps for lint results
- Removed the
post-resultsjob that posted sticky PR comments - Added job summary steps to both
lint-gh-cli-readmeandlint-scripts-readmejobs to display results inline - Simplified lint result file naming from specific names to generic
lint-results.txt
Comments suppressed due to low confidence (1)
.github/workflows/lint-readme.yml:55
- The
|| truehas been removed from the lint command, which means the step will now fail when the lint script exits with a non-zero status (when issues are found). However, the next step "Post lint results to job summary" depends on the lint results file being created.
The problem is that when the lint script fails (exit code 1 on line 205 of lint-readme.js), the entire step will fail and subsequent steps may not run as expected, even with if: always(). The set -o pipefail option will also cause the pipeline to fail if any command in the pipe fails.
Consider either:
- Keeping the
|| trueto ensure the step completes successfully while still capturing the lint results, or - Explicitly setting the step to continue on error using
continue-on-error: trueon the lint step, or - Handling the exit code explicitly with a trap or by capturing it in a variable
The current implementation will prevent the job summary from being properly populated when lint errors are found.
node ./.github/scripts/lint-readme.js ./scripts '##' '# scripts' | tee lint-results.txt
ef3ac65 to
1c40150
Compare
This pull request updates the linting workflow for README files by changing how lint results are handled and presented.
Before we posted a comment back to the PR, which was nice and great, but sadly this won't work with forks - duh.
Just using the status checks status themselves and the workflow job summary instead.