Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support workflow event dispatch via API #32059

Open
wants to merge 17 commits into
base: main
Choose a base branch
from

Conversation

bencurio
Copy link

@bencurio bencurio commented Sep 17, 2024

ref: #31765

@GiteaBot GiteaBot added the lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. label Sep 17, 2024
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label Sep 17, 2024
@github-actions github-actions bot added modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code labels Sep 17, 2024
techknowlogick and others added 7 commits September 18, 2024 10:42
Signed-off-by: Bence Santha <git@santha.eu>
Signed-off-by: Bence Santha <git@santha.eu>
Signed-off-by: Bence Santha <git@santha.eu>
Signed-off-by: Bence Santha <git@santha.eu>
@pull-request-size pull-request-size bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Sep 20, 2024
bencurio and others added 4 commits September 20, 2024 14:15
Signed-off-by: Bence Santha <git@santha.eu>
Signed-off-by: Bence Santha <git@santha.eu>
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Sep 24, 2024
Signed-off-by: Bence Santha <git@santha.eu>
@pull-request-size pull-request-size bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 2, 2024
@bencurio bencurio marked this pull request as ready for review October 2, 2024 10:18
@bencurio bencurio changed the title [WIP] Feature: Support workflow event dispatch via API Feature: Support workflow event dispatch via API Oct 2, 2024
routers/api/v1/api.go Outdated Show resolved Hide resolved
Signed-off-by: Bence Santha <git@santha.eu>
return
}
workflows, err := jobparser.Parse(content)
if err != nil || len(workflows) == 0 {
Copy link
Member

Choose a reason for hiding this comment

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

This will panic if err == nil.

Copy link
Author

Choose a reason for hiding this comment

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

I fixed it by adding a check for both the error and the empty workflows case. Now, it handles the scenario where len(workflows) == 0 after confirming that err == nil, preventing a potential panic.

Signed-off-by: Bence Santha <git@santha.eu>
@pull-request-size pull-request-size bot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Oct 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm/need 2 This PR needs two approvals by maintainers to be considered for merging. modifies/api This PR adds API routes or modifies them modifies/go Pull requests that update Go code size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants