Files
greptimedb/.github/workflows/apidoc.yml
T
Ning Sunanddennis zhuang 768834c465 ci: scope GITHUB_TOKEN permissions in workflows and fix ReDoS in compat updater (#10739)
Add a top-level `permissions: contents: read` to the 15 workflows that had
no default, so every job runs with a least-privilege token instead of the
repository's read/write default. Jobs that need more grant it explicitly:
`publish-github-release` (creates the release), the `update-compat-versions`
caller (a caller's permissions are the ceiling for the reusable workflow),
`apidoc` (deploys gh-pages), and nightly-ci `notification` (opens an issue).

Also rewrite the two array-capturing regexes in
`.github/scripts/update-compat-versions.py` from `(?:[^\]]|\n)*?` to
`[^\]]*?`; the alternation was redundant and backtracked exponentially on
newline-heavy input.

Resolves CodeQL `actions/missing-workflow-permissions` (79 alerts) and
`py/redos` (2 alerts).

Signed-off-by: Ning Sun <sunning@greptime.com>
Co-authored-by: dennis zhuang <killme2008@gmail.com>
2026-12-01 07:29:14 +00:00

47 lines
1.1 KiB
YAML

on:
push:
branches:
- main
paths-ignore:
- 'docs/**'
- 'config/**'
- '**.md'
- '.dockerignore'
- 'docker/**'
- '.gitignore'
name: Build API docs
# Least-privilege default for every job; jobs that need more grant it explicitly.
permissions:
contents: read
jobs:
apidoc:
runs-on: ubuntu-latest
permissions:
contents: write # github-pages-deploy-action pushes to gh-pages with GITHUB_TOKEN.
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: taiki-e/install-action@v2
with:
tool: protoc@3.23.4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo doc --workspace --no-deps --document-private-items
- run: |
cat <<EOF > target/doc/index.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="refresh" content="0; url='greptime/'" />
</head>
<body></body></html>
EOF
- name: Publish dist directory
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: target/doc
single-commit: true