mirror of
https://github.com/peter-evans/create-pull-request.git
synced 2026-05-14 10:32:42 +00:00
convert to draft on branch updates when there is a diff with base
This commit is contained in:
+14
-19
@@ -215,28 +215,9 @@ export class GitHubHelper {
|
||||
}
|
||||
}
|
||||
|
||||
// Convert back to draft if 'draft: always-true' is set
|
||||
if (inputs.draft.always && pull.draft !== undefined && !pull.draft) {
|
||||
await this.convertToDraft(pull.node_id)
|
||||
}
|
||||
|
||||
return pull
|
||||
}
|
||||
|
||||
private async convertToDraft(id: string): Promise<void> {
|
||||
core.info(`Converting pull request to draft`)
|
||||
await this.octokit.graphql({
|
||||
query: `mutation($pullRequestId: ID!) {
|
||||
convertPullRequestToDraft(input: {pullRequestId: $pullRequestId}) {
|
||||
pullRequest {
|
||||
isDraft
|
||||
}
|
||||
}
|
||||
}`,
|
||||
pullRequestId: id
|
||||
})
|
||||
}
|
||||
|
||||
async pushSignedCommits(
|
||||
branchCommits: Commit[],
|
||||
baseSha: string,
|
||||
@@ -368,4 +349,18 @@ export class GitHubHelper {
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
async convertToDraft(id: string): Promise<void> {
|
||||
core.info(`Converting pull request to draft`)
|
||||
await this.octokit.graphql({
|
||||
query: `mutation($pullRequestId: ID!) {
|
||||
convertPullRequestToDraft(input: {pullRequestId: $pullRequestId}) {
|
||||
pullRequest {
|
||||
isDraft
|
||||
}
|
||||
}
|
||||
}`,
|
||||
pullRequestId: id
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user