Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 25 additions & 65 deletions .github/workflows/lint-readme.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,20 @@ jobs:
id: lint
run: |
set -o pipefail
node ./.github/scripts/lint-readme.js | tee gh-cli-readme-lint-results.txt || true
node ./.github/scripts/lint-readme.js | tee lint-results.txt

- name: Upload lint results
if: steps.lint.outcome == 'failure' || steps.lint.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: gh-cli-readme-lint-results
path: gh-cli-readme-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
Expand All @@ -46,63 +52,17 @@ jobs:
id: lint
run: |
set -o pipefail
node ./.github/scripts/lint-readme.js ./scripts '##' '# scripts' | tee scripts-readme-lint-results.txt || true

- name: Upload lint results
if: steps.lint.outcome == 'failure' || steps.lint.outcome == 'success'
uses: actions/upload-artifact@v6
with:
name: scripts-readme-lint-results
path: scripts-readme-lint-results.txt

post-results:
name: Post Lint Results as PR Comment
runs-on: ubuntu-latest
if: always()
needs:
- lint-gh-cli-readme
- lint-scripts-readme
permissions:
pull-requests: write

steps:
- name: Download lint results
uses: actions/download-artifact@v7
with:
path: ./lint-results/
node ./.github/scripts/lint-readme.js ./scripts '##' '# scripts' | tee lint-results.txt

- name: Process Lint Results
id: process-results
- name: Post lint results to job summary
if: always()
run: |
echo "## 📋 Lint Results" > comment.md
echo "" >> comment.md

# Function to process lint results
process_lint_results() {
local title="$1"
local file="$2"

echo "### $title" >> comment.md
echo "\`\`\`" >> comment.md
if [ -f "$file" ]; then
cat "$file" >> comment.md
else
echo "❌ No results available" >> comment.md
fi
echo "\`\`\`" >> comment.md
echo "" >> comment.md
}

# Process both README results
process_lint_results "⚡ ./gh-cli scripts" "./lint-results/gh-cli-readme-lint-results/gh-cli-readme-lint-results.txt"
process_lint_results "🔧 ./scripts scripts" "./lint-results/scripts-readme-lint-results/scripts-readme-lint-results.txt"

echo "---" >> comment.md
echo "*Lint results updated at $(date)*" >> comment.md

- name: Post Sticky PR Comment
if: github.event_name == 'pull_request'
uses: marocchino/sticky-pull-request-comment@v2
with:
header: readme-lint-results
path: comment.md
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"