Auto-put PRs from release workflows in the proper milestone + minor things (#4862)

* Make workflow name use TitleCase

* Indicate in the PR description that it's a multi-part workflow

* Auto-put PRs from Prepare Release workflow in the proper milestone

* Rename "Publish the release" workflow to "Publish Release"

* Auto-put PR from Publish Release workflow in the proper milestone
This commit is contained in:
jack1142
2021-02-27 11:22:54 +01:00
committed by GitHub
parent bb90444979
commit 53c069a636
4 changed files with 87 additions and 4 deletions

View File

@@ -12,6 +12,8 @@ version_info = None
def repl(match: Match[str]) -> str:
global version_info
print(f"::set-output name=old_version::{match.group('version')}")
new_stable_version = os.environ.get("NEW_STABLE_VERSION", "auto")
if new_stable_version == "auto":
version_info = redbot.VersionInfo.from_str(match.group("version"))

View File

@@ -0,0 +1,49 @@
module.exports = (async function ({github, context}) {
const milestone_title = process.env.MILESTONE_TITLE;
const [repo_owner, repo_name] = process.env.GITHUB_REPOSITORY.split('/');
const {
repository: {
milestones: {
nodes: milestones,
pageInfo: {hasNextPage}
}
}
} = await github.graphql({
query: `
query getMilestoneNumberByTitle(
$repo_owner: String!
$repo_name: String!
$milestone_title: String!
) {
repository(owner:$repo_owner name:$repo_name) {
milestones(query:$milestone_title states:OPEN first:100) {
nodes {
number
title
}
pageInfo {
hasNextPage
}
}
}
}`,
repo_owner: repo_owner,
repo_name: repo_name,
milestone_title: milestone_title,
});
if (hasNextPage) {
// this should realistically never happen so let's just error
core.setFailed('Impossible happened! :)');
return;
}
for (const milestone of milestones)
if (milestone.title === milestone_title)
return milestone.number;
// if no exact match is found, assume the milestone doesn't exist
console.log('The milestone was not found. API returned the array: %o', milestones);
return null;
})