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

Close issue if action cancelled #4

Conversation

elmundio87
Copy link
Contributor

@elmundio87 elmundio87 commented Mar 30, 2022

If the workflow is cancelled due to user intervention or job timeout, this will ensure that the associated GitHub issue is closed, before the action exits.

This is achieved by intercepting the kill signal that the Docker container receives on job cancellation, and moving the main comment loop into a separate goroutine.

This should prevent issues being left behind when pipeline runs are cancelled.

I am using this in conjunction with the timeout-minutes parameter, to prevent approvals from running for excessive amounts of time.

@elmundio87
Copy link
Contributor Author

git diff is having a tough time with this branch so I'll add some comments to highlight the main review areas

main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
main.go Outdated Show resolved Hide resolved
Copy link
Owner

@trstringer trstringer left a comment

Choose a reason for hiding this comment

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

Thanks so much for the effort that you're putting into this! This is really great. Just some architectural and design changes to be made so that this project can scale from here. Thanks!

main.go Outdated Show resolved Hide resolved
Copy link
Owner

@trstringer trstringer left a comment

Choose a reason for hiding this comment

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

Sorry for the delay! Single small request for changes, then we can get this merged in. Thanks!

main.go Outdated Show resolved Hide resolved
@trstringer trstringer merged commit c24bf80 into trstringer:main Apr 28, 2022
@trstringer
Copy link
Owner

Thank you for your contribution!

trstringer added a commit that referenced this pull request May 24, 2022
This release contains two features:

* The ability to close the issue if the workflow was cancelled (#4)
* Debug logging for issue creation (#9)
@trstringer trstringer mentioned this pull request May 24, 2022
trstringer added a commit that referenced this pull request May 24, 2022
This release contains two features:

* The ability to close the issue if the workflow was cancelled (#4)
* Debug logging for issue creation (#9)
@elmundio87 elmundio87 deleted the feature/close-issue-if-workflow-cancelled branch July 5, 2022 14:09
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.

None yet

2 participants