Skip to content

Commit 665dae0

Browse files
committed
ci: skip SQLFluff Annotate on fork PRs
ignore-unauthorized-error does not catch the fork 403 (Resource not accessible by integration). Skip Annotate when head.repo != base repo so lint-mimic-iv can stay green.
1 parent 0da61fd commit 665dae0

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

.github/workflows/lint_sqlfluff.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: SQLFluff
22

33
# Lints changed mimic-iv/concepts/*.sql on pull requests and posts GitHub
4-
# annotations. permissions + ignore-unauthorized-error keep fork PRs usable.
4+
# annotations. Fork PRs skip Annotate — GITHUB_TOKEN cannot create check runs
5+
# from forks (Resource not accessible by integration / 403).
56
on:
67
- pull_request
78

@@ -40,7 +41,11 @@ jobs:
4041
shell: bash
4142
run: sqlfluff lint --format github-annotation --annotation-level failure --nofail ${{ steps.get_files_to_lint.outputs.lintees }} > annotations.json
4243
- name: Annotate
43-
if: steps.get_files_to_lint.outputs.lintees != ''
44+
# Same-repo PRs only: fork tokens get 403 creating check runs, and
45+
# ignore-unauthorized-error does not treat that as unauthorized.
46+
if: >
47+
steps.get_files_to_lint.outputs.lintees != '' &&
48+
github.event.pull_request.head.repo.full_name == github.repository
4449
uses: yuzutech/annotations-action@v0.6.0
4550
with:
4651
repo-token: "${{ secrets.GITHUB_TOKEN }}"

0 commit comments

Comments
 (0)