Skip to content
Merged
Show file tree
Hide file tree
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
13 changes: 7 additions & 6 deletions .github/workflows/deploy_versioned_docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,10 @@ jobs:
ref: ${{ github.event.release.tag_name }}

- name: Get Version from Release Tag
run: echo "VERSION=${GITHUB_EVENT_RELEASE_TAG_NAME}" >> $GITHUB_ENV
id: get_version
env:
GITHUB_EVENT_RELEASE_TAG_NAME: ${{ github.event.release.tag_name }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
run: echo "VERSION=${RELEASE_TAG}" >> "$GITHUB_OUTPUT"

- name: Setup Hugo
uses: peaceiris/actions-hugo@75d2e84710de30f6ff7268e08f310b60ef14033f # v3
Expand All @@ -58,7 +59,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
Expand All @@ -67,9 +68,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
Expand All @@ -89,4 +90,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 }}"
31 changes: 14 additions & 17 deletions .github/workflows/link_checker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ permissions:
pull-requests: write
issues: write


jobs:
link-check:
runs-on: ubuntu-latest
Expand All @@ -29,6 +28,7 @@ jobs:
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
with:
fetch-depth: 0

- name: Identify Changed Files
id: changed-files
shell: bash
Expand All @@ -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<<EOF" >> $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<<EOF" >> "$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
Expand All @@ -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:
Expand All @@ -75,14 +73,15 @@ 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
jobSummary: false
debug: false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Find comment
uses: peter-evans/find-comment@b30e6a3c0ed37e7c023ccd3f1db5c6c0b0c23aad # v4
id: find-comment
Expand All @@ -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 }}
Expand Down
Loading