Post-creation script option #387
jamestelfer
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
There's a variety of actions that may be desired after creating a PR: changing assignees/reviewers dynamically, adding to a project, dynamic tagging, updating links in the PR body, ... the potential list is quite long.
Instead of trying to make all these things work, we could instead add a
postExecuteSuccessful
script hook to the configuration. This would be executed in the context of the repository after a successful script run, and after the pull/merge request has been created.A number of details can be passed as environment variables to the hook script, including:
REPOSITORY
REQUEST_URL
REQUEST_NUMBER
REQUEST_STATUS
(CREATED
/REPLACED
/SKIPPED
) -- if the branch was created, replaced or if it was skipped because one already existed.Given the repository and PR number, it's relatively straightforwards to use the GitHub CLI to modify tags, add comments or change the PR description (say, annotating it with PR content-specific data for example).
Good idea/bad idea?
I've been using this in conjunction with GitHub projects, so after a PR is created I run a script to add the PR to a project, and then another to tag the PR with metadata that's specific to the repository. Conceivably I could switch to maintain issues in JIRA instead using this approach (I could, regardless whether I wanted to...).
Beta Was this translation helpful? Give feedback.
All reactions