Docs: add metadata search to ent. feature table #3524
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Docs Preview and Link Check | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened, closed] | |
paths: | |
- "docs/**" | |
- ".github/workflows/docs.yaml" | |
- ".github/workflows/docs-*.yaml" | |
branches: | |
- master | |
jobs: | |
# This job name kept short because it's used in the preview URL | |
preview: | |
name: Docs PR - Publish preview and check links | |
runs-on: ubuntu-22.04 | |
permissions: | |
pull-requests: write | |
steps: | |
- name: Check-out | |
uses: actions/checkout@v4 | |
- name: Setup Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.12' | |
- name: Install dependencies | |
working-directory: docs | |
run: pip install -r requirements-docs.txt | |
- name: Build latest | |
id: build-latest | |
working-directory: docs | |
run: mkdocs build | |
- name: Overlay PR message on each page | |
working-directory: docs/site | |
run: | | |
PR_URL=${{ github.event.pull_request.html_url }} | |
PR_NUMBER=${{ github.event.pull_request.number }} | |
html_files=$(find . -name '*.html') | |
for file in $html_files; do | |
sed -i -e "s|\(.*\)\(</body>\)|<div style=\"position: fixed; top: 5px; left: 5px; padding: 3px; background-color: #e8ac07; font-weight: bold; z-index: 9999; box-shadow: 0 0 10px rgba(0,0,0,0.5);\">ℹ️ This is a preview of PR <a href=\"$PR_URL\" style=\"color: black;\">#$PR_NUMBER</a></div>\n\1\2|" $file | |
done | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.DOCS_PREVIEW_AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.DOCS_PREVIEW_AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Publish preview site | |
run: aws s3 sync docs/site/ s3://lakefs-docs-pr-previews/prs/pr-${{ github.event.pull_request.number }}/ | |
- name: Comment with preview URL | |
uses: actions/github-script@v7 | |
with: | |
script: | | |
const previewUrl = `https://pr-${context.payload.pull_request.number}.docs-lakefs-preview.io/`; | |
let commentBody = `📚 Documentation preview at ${previewUrl}`; | |
// Check if a preview comment already exists | |
const { data: comments } = await github.rest.issues.listComments({ | |
issue_number: context.payload.pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
const existingComment = comments.find(comment => | |
comment.body.includes(' Documentation preview at ') && comment.user.type === 'Bot' | |
); | |
if (existingComment) { | |
const pr = context.payload.pull_request | |
const useSha = pr ? pr.head.sha : context.sha; | |
const shortSha = useSha.substring(0,7); | |
commentBody += `\n\n*(Updated: ${new Date().toLocaleString()} - Commit: ${shortSha})*`; | |
await github.rest.issues.updateComment({ | |
comment_id: existingComment.id, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: commentBody | |
}); | |
core.info('Updated existing preview comment'); | |
} else { | |
await github.rest.issues.createComment({ | |
issue_number: context.payload.pull_request.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
body: commentBody | |
}); | |
core.info('Created new preview comment'); | |
} | |
- name: Check links | |
id: lychee | |
uses: lycheeverse/lychee-action@v2 | |
with: | |
args: docs/site --no-progress --root-dir ${{ github.workspace }}/docs/site | |
fail: true | |
jobSummary: true | |
format: markdown | |
env: | |
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} | |
- uses: actions/upload-artifact@v4 | |
name: Upload links report | |
if: failure() | |
with: | |
name: links-report | |
path: lychee/out.md |