resolved the comments

This commit is contained in:
rahulpinto19
2026-02-17 10:46:19 +00:00
parent 503481244b
commit 7d905012f4

View File

@@ -18,6 +18,7 @@ on:
permissions:
contents: read
pull-requests: write
issues: write
jobs:
@@ -43,10 +44,13 @@ jobs:
echo "$CHANGED_FILES"
echo "-----------------------------"
# Flatten newlines to spaces for the args list
FILES_FLAT=$(echo "$CHANGED_FILES" | tr '\n' ' ')
# FIX: Wrap filenames in quotes to handle spaces
FILES_QUOTED=$(echo "$CHANGED_FILES" | sed 's/^/"/;s/$/"/' | tr '\n' ' ')
echo "CHECK_FILES=$FILES_FLAT" >> $GITHUB_ENV
# Write to env using EOF pattern
echo "CHECK_FILES<<EOF" >> $GITHUB_ENV
echo "$FILES_QUOTED" >> $GITHUB_ENV
echo "EOF" >> $GITHUB_ENV
echo "HAS_CHANGES=true" >> $GITHUB_ENV
fi
@@ -80,26 +84,32 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Find comment
if: env.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure'
uses: peter-evans/find-comment@v3
uses: peter-evans/find-comment@v4
id: find-comment
with:
issue-number: ${{ github.event.pull_request.number }}
comment-author: 'github-actions[bot]'
body-includes: "## Link Resolution Note"
- name: Delete comment on success
if: steps.lychee-check.outcome == 'success' && steps.find-comment.outputs.comment-id != ''
run: |
gh api \
--method DELETE \
-H "Accept: application/vnd.github+json" \
/repos/${{ github.repository }}/issues/comments/${{ steps.find-comment.outputs.comment-id }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Prepare Report
if: env.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure'
run: |
# Create a new file 'full-report.md'
echo "## Link Resolution Note" > full-report.md
echo "Local links and directory changes work differently on GitHub than on the docsite." >> full-report.md
echo "You must ensure fixes pass the **GitHub check** and also work with **\`hugo server\`**." >> full-report.md
echo "See [Link Checking and Fixing with Lychee](https://github.com/googleapis/genai-toolbox/blob/main/DEVELOPER.md#link-checking-and-fixing-with-lychee) for more details." >> full-report.md
echo "---" >> full-report.md
echo "### Broken Links Found" >> full-report.md
# Clean the report (remove redirects) AND append it to the file
echo "Local links and directory changes work differently on GitHub than on the docsite.You must ensure fixes pass the **GitHub check** and also work with **\`hugo server\`**." >> full-report.md
echo "See [Link Checking and Fixing with Lychee](https://github.com/googleapis/genai-toolbox/blob/main/DEVELOPER.md#link-checking-and-fixing-with-lychee) for more details." >> full-report.md
echo "" >> full-report.md
sed -E '/(Redirect|Redirects per input)/d' lychee-report.md >> full-report.md
- name: Create PR Comment