feat(github): add workflow_dispatch to the GitHub notification service#459
Open
yugstar wants to merge 1 commit into
Open
feat(github): add workflow_dispatch to the GitHub notification service#459yugstar wants to merge 1 commit into
yugstar wants to merge 1 commit into
Conversation
The GitHub notification service supported repository_dispatch but not workflow_dispatch. Add a workflowDispatch option that triggers a workflow dispatch event for a given workflow file and ref, with optional templated inputs, mirroring the existing repositoryDispatch implementation. Closes argoproj#442 Signed-off-by: Aman Raj <aman.yug@gmail.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #459 +/- ##
==========================================
+ Coverage 55.41% 57.13% +1.72%
==========================================
Files 46 49 +3
Lines 4125 3824 -301
==========================================
- Hits 2286 2185 -101
+ Misses 1511 1273 -238
- Partials 328 366 +38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Author
|
For context on why this is worth having alongside the existing
The original issue (#442) asked for both, and this completes the second half. The implementation mirrors |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #442
What
Adds a
workflowDispatchoption to the GitHub notification service so a notification can trigger a GitHub Actions workflow dispatch event.The service already supported
repository_dispatch(#393);workflow_dispatchwas the remaining half of #442.Usage
workflow— the workflow file name (e.g.deploy.yml) or its ID.ref— the branch or tag the workflow runs from.inputs— optional JSON object of workflow inputs (templated, then decoded into the inputs map).The GitHub App / token needs the
actions: writepermission.Implementation
Mirrors the existing
repositoryDispatchdesign end to end:GitHubWorkflowDispatchstruct +workflowDispatchfield onGitHubNotification.workflow,ref, andinputs(theinputsJSON string is templated thenjson.Unmarshal-ed into the inputs map, just likerepositoryDispatch.clientPayload).actionsServiceinterface +GetActions()on thegithubClientinterface and adapter, callingActions.CreateWorkflowDispatchEventByFileName(go-github v69).Tests
TestGetTemplater_Github_WorkflowDispatch— verifiesworkflow,ref, andinputstemplate correctly.TestGitHubService_Send_WorkflowDispatch— verifies the dispatch is sent with the right workflow file, ref, and decoded inputs map.go build,go vet,gofmt, and the fullpkg/servicestest suite pass.