Skip to content

add valid github scopes#36977

Merged
lunny merged 3 commits into
go-gitea:mainfrom
TheFox0x7:gh-scopes
Mar 24, 2026
Merged

add valid github scopes#36977
lunny merged 3 commits into
go-gitea:mainfrom
TheFox0x7:gh-scopes

Conversation

@TheFox0x7
Copy link
Copy Markdown
Contributor

test for github supported scopes with test to ensure all of them work and don't panic

fixes: #36967

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Mar 24, 2026
@silverwind silverwind requested a review from Copilot March 24, 2026 17:41
Comment thread services/actions/permission_parser.go
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds compatibility for GitHub Actions permissions: scopes so Gitea’s workflow permission parsing doesn’t panic when encountering GitHub-supported (but Gitea-unsupported) scopes, and introduces a regression test to cover those scope names.

Changes:

  • Treat several GitHub-supported permissions scopes as explicit no-ops instead of triggering PanicInDevOrTesting.
  • Add a test that parses a YAML permissions mapping containing all currently documented GitHub scopes to ensure parsing doesn’t panic.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
services/actions/permission_parser.go Adds a no-op switch case list for GitHub-only scopes (e.g. security-events) to prevent panics.
services/actions/permission_parser_test.go Adds a test enumerating GitHub-supported scopes to ensure the parser accepts them without panicking.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread services/actions/permission_parser.go
Comment thread services/actions/permission_parser.go Outdated
Comment thread services/actions/permission_parser_test.go
@GiteaBot GiteaBot added lgtm/need 1 This PR needs approval from one additional maintainer to be merged. and removed lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. labels Mar 24, 2026
@GiteaBot GiteaBot added lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore. and removed lgtm/need 1 This PR needs approval from one additional maintainer to be merged. labels Mar 24, 2026
@lunny lunny added the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 24, 2026
@lunny lunny enabled auto-merge (squash) March 24, 2026 18:47
@lunny lunny merged commit cfd9008 into go-gitea:main Mar 24, 2026
26 checks passed
@GiteaBot GiteaBot added this to the 1.26.0 milestone Mar 24, 2026
@GiteaBot GiteaBot removed the reviewed/wait-merge This pull request is part of the merge queue. It will be merged soon. label Mar 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm/done This PR has enough approvals to get merged. There are no important open reservations anymore.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Panic when parseing actions workflow

7 participants