From a8079c6d7642cff737844a813787b2247bf3e4b4 Mon Sep 17 00:00:00 2001 From: duwenxin Date: Mon, 23 Feb 2026 23:39:03 -0500 Subject: [PATCH 1/2] ci: update Github Actions to use environment files --- .github/workflows/deploy_versioned_docs.yaml | 13 ++++---- .github/workflows/link_checker.yaml | 31 +++++++++----------- 2 files changed, 20 insertions(+), 24 deletions(-) diff --git a/.github/workflows/deploy_versioned_docs.yaml b/.github/workflows/deploy_versioned_docs.yaml index 8da91c95be5c..e8c1733f4014 100644 --- a/.github/workflows/deploy_versioned_docs.yaml +++ b/.github/workflows/deploy_versioned_docs.yaml @@ -35,9 +35,8 @@ jobs: ref: ${{ github.event.release.tag_name }} - name: Get Version from Release Tag - run: echo "VERSION=${GITHUB_EVENT_RELEASE_TAG_NAME}" >> $GITHUB_ENV - env: - GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }} + id: get_version + run: echo "VERSION=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" - name: Setup Hugo uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3 @@ -58,7 +57,7 @@ jobs: run: hugo --minify working-directory: .hugo env: - HUGO_BASEURL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ env.VERSION }}/ + HUGO_BASEURL: https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/${{ steps.get_version.outputs.VERSION }}/ HUGO_RELATIVEURLS: false - name: Deploy @@ -67,9 +66,9 @@ jobs: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: .hugo/public publish_branch: versioned-gh-pages - destination_dir: ./${{ env.VERSION }} + destination_dir: ./${{ steps.get_version.outputs.VERSION }} keep_files: true - commit_message: "deploy: docs for ${{ env.VERSION }}" + commit_message: "deploy: docs for ${{ steps.get_version.outputs.VERSION }}" - name: Clean Build Directory run: rm -rf .hugo/public @@ -89,4 +88,4 @@ jobs: publish_branch: versioned-gh-pages keep_files: true allow_empty_commit: true - commit_message: "deploy: docs to root for ${{ env.VERSION }}" + commit_message: "deploy: docs to root for ${{ steps.get_version.outputs.VERSION }}" diff --git a/.github/workflows/link_checker.yaml b/.github/workflows/link_checker.yaml index ef835d8b6d78..b535a21fc498 100644 --- a/.github/workflows/link_checker.yaml +++ b/.github/workflows/link_checker.yaml @@ -20,7 +20,6 @@ permissions: pull-requests: write issues: write - jobs: link-check: runs-on: ubuntu-latest @@ -29,6 +28,7 @@ jobs: uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 with: fetch-depth: 0 + - name: Identify Changed Files id: changed-files shell: bash @@ -38,25 +38,23 @@ jobs: if [ -z "$CHANGED_FILES" ]; then echo "No markdown files changed. Skipping checks." - echo "HAS_CHANGES=false" >> $GITHUB_ENV + echo "HAS_CHANGES=false" >> "$GITHUB_OUTPUT" else echo "--- Changed Files to Scan ---" echo "$CHANGED_FILES" echo "-----------------------------" - # FIX: Wrap filenames in quotes to handle spaces FILES_QUOTED=$(echo "$CHANGED_FILES" | sed 's/^/"/;s/$/"/' | tr '\n' ' ') - # 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 + # Use EOF to write multiline or long strings to GITHUB_OUTPUT + echo "HAS_CHANGES=true" >> "$GITHUB_OUTPUT" + echo "CHECK_FILES<> "$GITHUB_OUTPUT" + echo "$FILES_QUOTED" >> "$GITHUB_OUTPUT" + echo "EOF" >> "$GITHUB_OUTPUT" fi - - name: Restore lychee cache - if: env.HAS_CHANGES == 'true' + if: steps.changed-files.outputs.HAS_CHANGES == 'true' uses: actions/cache@cdf6c1fa76f9f475f3d7449005a359c84ca0f306 # v5 with: path: .lycheecache @@ -65,7 +63,7 @@ jobs: - name: Link Checker id: lychee-check - if: env.HAS_CHANGES == 'true' + if: steps.changed-files.outputs.HAS_CHANGES == 'true' uses: lycheeverse/lychee-action@a8c4c7cb88f0c7386610c35eb25108e448569cb0 # v2 continue-on-error: true with: @@ -75,7 +73,7 @@ jobs: --cache --max-cache-age 1d --exclude '^neo4j\+.*' --exclude '^bolt://.*' - ${{ env.CHECK_FILES }} + ${{ steps.changed-files.outputs.CHECK_FILES }} output: lychee-report.md format: markdown fail: true @@ -83,6 +81,7 @@ jobs: debug: false env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Find comment uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4 id: find-comment @@ -103,18 +102,16 @@ jobs: STEPS_FIND_COMMENT_OUTPUTS_COMMENT_ID: ${{ steps.find-comment.outputs.comment-id }} - name: Prepare Report - if: env.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure' + if: steps.changed-files.outputs.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure' run: | echo "## Link Resolution Note" > full-report.md - - - 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 "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 - if: env.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure' + if: steps.changed-files.outputs.HAS_CHANGES == 'true' && steps.lychee-check.outcome == 'failure' uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v5 with: comment-id: ${{ steps.find-comment.outputs.comment-id }} From 24e758233b90249072910066819b8d52f856790a Mon Sep 17 00:00:00 2001 From: duwenxin Date: Thu, 26 Feb 2026 12:37:25 -0500 Subject: [PATCH 2/2] resolve comments --- .github/workflows/deploy_versioned_docs.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/deploy_versioned_docs.yaml b/.github/workflows/deploy_versioned_docs.yaml index e8c1733f4014..adc4bfedf6ff 100644 --- a/.github/workflows/deploy_versioned_docs.yaml +++ b/.github/workflows/deploy_versioned_docs.yaml @@ -36,7 +36,9 @@ jobs: - name: Get Version from Release Tag id: get_version - run: echo "VERSION=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" + env: + RELEASE_TAG: ${{ github.event.release.tag_name }} + run: echo "VERSION=${RELEASE_TAG}" >> "$GITHUB_OUTPUT" - name: Setup Hugo uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3