-
Notifications
You must be signed in to change notification settings - Fork 119
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
ci: Copy properties from issue to pull request #1310
ci: Copy properties from issue to pull request #1310
Conversation
Timestamp: 2020-11-20 15:12:37 |
7409fbd
to
fe8d175
Compare
Codecov Report
@@ Coverage Diff @@
## master #1310 +/- ##
=========================================
Coverage 78.99% 78.99%
Complexity 703 703
=========================================
Files 244 244
Lines 4685 4685
Branches 825 825
=========================================
Hits 3701 3701
Misses 555 555
Partials 429 429 |
I think we always want a reference to the ticket in the description for pull requests related to an issue (this is how GitHub links PRs to issues). GitHub doesn't understand the branch convention. |
0bbe934
to
34d0d0b
Compare
Yes, the branch is just a fallback :) 99% of cases it will take it from description |
12a0fdb
to
d40dd29
Compare
private suspend fun getLabelsFromIssue(githubToken: String, issueNumber: Int) = | ||
Fuel.get("https://api.github.com/repos/Flank/flank/issues/$issueNumber/labels") | ||
.appendHeader("Accept", "application/vnd.github.v3+json") | ||
.appendHeader("Authorization", "token $githubToken") |
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.
In GitHubApi.kt
we have function appendHeaders
. This function adds these headers to the request. Maybe we could use these functions in this and other places? WDYT?
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.
I think that this is very good idea
04f5aca
to
cc30c4e
Compare
suspend fun setAssigneesToPullRequest(githubToken: String, pullRequestNumber: Int, assignees: List<String>) { | ||
Fuel.post("https://api.github.com/repos/Flank/flank/issues/$pullRequestNumber/assignees") | ||
.appendHeader("Accept", "application/vnd.github.v3+json") | ||
.appendHeader("Authorization", "token $githubToken") |
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.
Here we can use .appendHeaders(githubToken)
too
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.
fixed!
flank-scripts/src/main/kotlin/flank/scripts/pullrequest/GitHubIssuePropertiesCopy.kt
Outdated
Show resolved
Hide resolved
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.
Fixed! Thanks for finding it! In case of copy epics, it is not so easy using Zenhub API, because it does not return epic for an issue. You could just get all epics and list issues in it, so it will not be very optimal |
I see, thanks for info. |
url.endsWith("/releases/latest") && request.containsSuccessHeader() -> request.buildResponse( | ||
GitHubRelease("v20.08.0").toJson(), | ||
200 | ||
) |
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.
Could we use one style of argument formatting in this file?
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.
👍
…IssuePropertiesCopy.kt Co-authored-by: pawelpasterz <[email protected]>
a3753e9
to
bd87d68
Compare
Fixes #1092
Test Plan
When creating pull request labels, assignees and estimates are copied from source issue.
Source issue is discovered by:
or
To test it locally use command:
flankScripts pullRequest copyProperties --github-token=<github token> --zenhub-token=<zenhub token, contact me if you would like to test it> --pr-number=<number of PR>
Checklist