refactor: streamline lint results handling in GitHub Actions workflow… #306
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Lint | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| jobs: | |
| lint-gh-cli-readme: | |
| name: Lint ./gh-cli/README.md | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Lint ./gh-cli/README.md | |
| id: lint | |
| run: | | |
| set -o pipefail | |
| node ./.github/scripts/lint-readme.js | tee lint-results.txt | |
| - name: Post lint results to job summary | |
| if: always() | |
| run: | | |
| echo "## Lint Results for ./gh-cli/README.md" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| if [ -f lint-results.txt ]; then | |
| cat lint-results.txt >> "$GITHUB_STEP_SUMMARY" | |
| else | |
| echo "No results available" >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| lint-scripts-readme: | |
| name: Lint ./scripts/README.md | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Lint ./scripts/README.md | |
| id: lint | |
| run: | | |
| set -o pipefail | |
| node ./.github/scripts/lint-readme.js ./scripts '##' '# scripts' | tee lint-results.txt | |
| - name: Post lint results to job summary | |
| if: always() | |
| run: | | |
| echo "## Lint Results for ./scripts/README.md" >> "$GITHUB_STEP_SUMMARY" | |
| echo "" >> "$GITHUB_STEP_SUMMARY" | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" | |
| if [ -f lint-results.txt ]; then | |
| cat lint-results.txt >> "$GITHUB_STEP_SUMMARY" | |
| else | |
| echo "No results available" >> "$GITHUB_STEP_SUMMARY" | |
| fi | |
| echo '```' >> "$GITHUB_STEP_SUMMARY" |