* fix: rewrite relative URLs when syncing to GitHub discussion Relative URLs back to supabse.com won't work in GitHub discussions, so rewrite them back to absolute URLs starting with https://supabase.com * fix: replace all supabase urls with relative urls * chore: add linting for relative urls * chore: bump linter version * Prettier --------- Co-authored-by: Chris Chinchilla <chris.ward@supabase.io>
62 lines
2.0 KiB
YAML
62 lines
2.0 KiB
YAML
name: '[Docs] Lint v2 (scheduled)'
|
|
on:
|
|
schedule:
|
|
- cron: '0 0 * * *'
|
|
workflow_dispatch:
|
|
|
|
env:
|
|
CARGO_NET_GIT_FETCH_WITH_CLI: true
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
|
|
jobs:
|
|
lint-all:
|
|
runs-on: blacksmith-4vcpu-ubuntu-2404
|
|
steps:
|
|
- uses: actions/checkout@v3
|
|
with:
|
|
fetch-depth: 0
|
|
sparse-checkout: |
|
|
supa-mdx-lint.config.toml
|
|
supa-mdx-lint
|
|
apps/docs/content
|
|
- name: cache cargo
|
|
id: cache-cargo
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: |
|
|
~/.cargo/bin/
|
|
~/.cargo/registry/index/
|
|
~/.cargo/registry/cache/
|
|
~/.cargo/git/db/
|
|
key: 301e0d4b35f8f0c8553b4e93917b8b2685ef2627
|
|
- name: install linter
|
|
if: steps.cache-cargo.outputs.cache-hit != 'true'
|
|
run: cargo install --locked --git https://github.com/supabase-community/supa-mdx-lint --rev 301e0d4b35f8f0c8553b4e93917b8b2685ef2627
|
|
- name: run linter
|
|
env:
|
|
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
run: |
|
|
supa-mdx-lint apps/docs/content || {
|
|
echo "Linter failed, attempting to fix errors..."
|
|
git config --global user.name 'github-docs-bot'
|
|
git config --global user.email 'github-docs-bot@supabase.com'
|
|
BRANCH_NAME="bot/docs-lint-fixes"
|
|
EXISTING_BRANCH=$(git ls-remote --heads origin $BRANCH_NAME)
|
|
if [[ -n "$EXISTING_BRANCH" ]]; then
|
|
git push origin --delete $BRANCH_NAME
|
|
fi
|
|
git checkout -b $BRANCH_NAME
|
|
supa-mdx-lint apps/docs/content --fix || FIX_FAILED=1
|
|
git add .
|
|
git commit -m '[bot] fix lint errors' || true
|
|
git push origin $BRANCH_NAME
|
|
gh pr create --title '[bot] fix lint errors' --body 'This PR fixes lint errors in the documentation.' --head $BRANCH_NAME
|
|
if [ "${FIX_FAILED:-0}" -eq 1 ]; then
|
|
echo "Fix did not correct all errors."
|
|
exit 1
|
|
fi
|
|
}
|