Skip to content

ci: fix SQLFluff annotation permissions for fork PRs - #2148

Open
Chessing234 wants to merge 6 commits into
MIT-LCP:mainfrom
Chessing234:ci/sqlfluff-annotate-permissions
Open

ci: fix SQLFluff annotation permissions for fork PRs#2148
Chessing234 wants to merge 6 commits into
MIT-LCP:mainfrom
Chessing234:ci/sqlfluff-annotate-permissions

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

Summary

  • Split out of the too-broad fix: load paths, imports, transpile, and CI permissions #2128 per review: focus only on SQLFluff CI.
  • Give the workflow contents: read + checks: write, skip annotate when no concept SQL changed, and set ignore-unauthorized-error: true.
  • Document the contract in the workflow header + style guide, and add a local lint helper script.

Test plan

  • Open/update a PR that does not touch mimic-iv/concepts/**/*.sql — SQLFluff job should skip lint/annotate cleanly
  • Open a PR that changes a concept .sql file — annotations post (or are ignored gracefully on forks)
  • ./scripts/lint_changed_mimic_iv_concepts.sh against a branch with concept edits

Made with Cursor

Chessing234 and others added 5 commits July 31, 2026 15:05
Fork PRs need an explicit checks:write grant so the annotation action can
post findings without relying on the default GITHUB_TOKEN scope.

Co-authored-by: Cursor <cursoragent@cursor.com>
Avoid running the annotations action against a missing annotations.json on
PRs that do not touch mimic-iv/concepts, and tolerate unauthorized check
writes with ignore-unauthorized-error.

Co-authored-by: Cursor <cursoragent@cursor.com>
Spell out why the workflow sets checks:write and ignore-unauthorized-error so
future edits do not reintroduce continue-on-error.

Co-authored-by: Cursor <cursoragent@cursor.com>
Point contributors at the workflow that reviews changed MIMIC-IV concept SQL.

Co-authored-by: Cursor <cursoragent@cursor.com>
Mirrors the PR workflow so contributors can lint mimic-iv/concepts changes
before pushing.

Co-authored-by: Cursor <cursoragent@cursor.com>
@Chessing234

Copy link
Copy Markdown
Contributor Author

This unblocks fork PRs: every recent Chessing234 mimic-iv PR is red only on the Annotate step (Resource not accessible by integration), while Lint SQL itself succeeds. Happy to adjust if reviewers want a smaller permissions footprint.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant