-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add helper to get runID
from Custom Deployment Protection Rule Event
#3476
base: master
Are you sure you want to change the base?
Add helper to get runID
from Custom Deployment Protection Rule Event
#3476
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
runID
from Custom Deployment Protection Rule Event
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #3476 +/- ##
==========================================
- Coverage 91.04% 91.02% -0.02%
==========================================
Files 179 179
Lines 15551 15562 +11
==========================================
+ Hits 14158 14166 +8
- Misses 1221 1223 +2
- Partials 172 173 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you, @pputman-clabs.
It might be nice to add a comment to the other functions that required a runID
that this new helper can be used to easily extract the value from the event.
Okay I made the requested changes, thanks for the feedback! Let me know if there's anything else programming wise you think I should change and if not I'll start adding the documentation for it to the other method docs. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert changes to go.mod and go.sum, as this helper and its tests should not require any more dependencies than we already have.
Fixed, I didn't even notice those had updated, sorry. Thanks for the feedback, I'm learning as I go here. |
…s/go-github into pputman/add-helper-function
github/github.go
Outdated
// Helper Function to extract the workflow RunID from the *DeploymentProtectionRuleEvent.DeploymentCallBackURL. | ||
func (e *DeploymentProtectionRuleEvent) GetRunID() (int64, error) { | ||
match := r.FindStringSubmatch(*e.DeploymentCallbackURL) | ||
var ErrNoMatch = errors.New("no match found") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line is not idiomatic Go for two reasons:
- there is no need to export (capitalize) it
- it is only used once and provides no more useful information by making it a separate line.
Therefore, please revert this change.
…the use of the new helper function
Made requested changes, and added a comment to the actions_workflow_runs.go methods that they can use this helper function to easily pull out the RunID |
Added Helper Function with test to get the RunID from the DeploymentCallbackURL and convert it to an int64.