mirror of
https://github.com/Heretek-AI/awesome-opencode.git
synced 2026-11-07 10:45:57 -10:00
pull_request.base.sha is the base commit from when an older PR was opened, so validate counted everything merged to main since then (README.md, dist/registry.json, other entries) as part of the PR and failed it. Use origin/<base ref>, whose merge base with the PR merge commit is the current base tip. Co-Authored-By: Claude Opus 5.5 <[email protected]>
60 lines
2.1 KiB
YAML
60 lines
2.1 KiB
YAML
# The required "validate" status check. Runs on every PR (including README-only and non-data PRs, so
|
|
# hand edits to generated files get feedback). Runs on PRs opened by github-actions[bot] are held for
|
|
# approval by GitHub; the bot workflows approve their own. workflow_dispatch is for manual runs.
|
|
name: Validate PR
|
|
|
|
on:
|
|
pull_request:
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
|
|
concurrency:
|
|
group: validate-${{ github.event.pull_request.number || github.ref }}
|
|
cancel-in-progress: true
|
|
|
|
jobs:
|
|
validate:
|
|
name: validate
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v7
|
|
with:
|
|
fetch-depth: 0
|
|
persist-credentials: false
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v7
|
|
with:
|
|
node-version: '24'
|
|
cache: npm
|
|
|
|
- name: Install dependencies
|
|
run: npm ci --ignore-scripts
|
|
|
|
- name: Unit tests
|
|
run: npm test
|
|
|
|
- name: Check catalog changes
|
|
env:
|
|
GITHUB_TOKEN: ${{ github.token }}
|
|
# Compare against the current base branch, not pull_request.base.sha: on an older PR that is the base
|
|
# commit from when the PR was opened, which would count everything merged since as part of the PR
|
|
BASE_REF: origin/${{ github.event.pull_request.base.ref || 'main' }}
|
|
# Only the README bot's own PRs (opened by github-actions[bot] from this repo's bot/readme-* branches)
|
|
# may change the generated files
|
|
ALLOW_GENERATED: ${{ github.event_name == 'pull_request' && github.event.pull_request.user.login == 'github-actions[bot]' && github.event.pull_request.head.repo.full_name == github.repository && startsWith(github.head_ref, 'bot/readme-') }}
|
|
run: |
|
|
if [ "$ALLOW_GENERATED" = "true" ]; then
|
|
node scripts/check-pr.js --base "$BASE_REF" --allow-generated
|
|
else
|
|
node scripts/check-pr.js --base "$BASE_REF"
|
|
fi
|
|
|
|
- name: README and registry still generate
|
|
run: |
|
|
node scripts/generate-readme.js
|
|
node scripts/export-json.js --output "$RUNNER_TEMP/registry.json"
|