From 7d905012f46f23998f25df9203951451f25ba85b Mon Sep 17 00:00:00 2001 From: rahulpinto19 Date: Tue, 17 Feb 2026 10:46:19 +0000 Subject: [PATCH] resolved the comments --- .github/workflows/link_checker_workflow.yaml | 34 +++++++++++++------- 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/.github/workflows/link_checker_workflow.yaml b/.github/workflows/link_checker_workflow.yaml index c372a7e216..c711227929 100644 --- a/.github/workflows/link_checker_workflow.yaml +++ b/.github/workflows/link_checker_workflow.yaml @@ -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<> $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