-
Notifications
You must be signed in to change notification settings - Fork 93
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 'payload' field to allow for Repository Dispatch #341
base: main
Are you sure you want to change the base?
Conversation
Update from parent
Hey Jon! We would welcome this addition! Do you mind adding some tests? I'll leave you some comments on the documentation |
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.
Requested a few changes docs-wise and adding some tests wouldn't hurt!
Co-authored-by: Omer Bensaadon <omerbensaadon@github.com>
Thanks @omerbensaadon ! Changes to README completed. I'm not aware of a way to add a test using Repository Dispatch, since it takes flow control away from the current environment 😞 |
@@ -37,6 +37,7 @@ interface ProjectV2AddDraftIssueResponse { | |||
} | |||
|
|||
export async function addToProject(): Promise<void> { | |||
const payload = core.getInput('payload') ? JSON.parse(core.getInput('payload')) : github.context.payload |
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.
const payload = core.getInput('payload') ? JSON.parse(core.getInput('payload')) : github.context.payload | |
const inputPayload = core.getInput('payload') | |
cont payload = inputPayload ? JSON.parse(inputPayload) : github.context.payload |
For the test here, I think it's ok to just test that side of the workflow changes. Particularly we might add a new test that calls a sample of other input mocks is here: add-to-project/__tests__/add-to-project.test.ts Lines 14 to 17 in ce05fa3
that should at least validate that the code accepts a payload as input |
is this going to be merged? This feature is a must for |
Currently, actions/add-to-project cannot be used via repository_dispatch (or workflow_dispatch) since it retrieves all event-related information from the immediate github context, which is distinct from the dispatching workflow context.
This PR adds the ability to pass relevant context information from a dispatching workflow to a target workflow, and provides relevant documentation & code samples.