-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
102 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#!/bin/env python3 | ||
|
||
# This script is running with elevated privileges from the main branch against pull requests. | ||
|
||
import re | ||
import sys | ||
import tomllib | ||
from pathlib import Path | ||
|
||
from git import Repo | ||
|
||
|
||
def main(): | ||
assert len(sys.argv) == 3 | ||
|
||
with open("pyproject.toml", "rb") as fp: | ||
PYPROJECT_TOML = tomllib.load(fp) | ||
BLOCKING_REGEX = re.compile(r"DRAFT|WIP|NO\s*MERGE|DO\s*NOT\s*MERGE|EXPERIMENT") | ||
ISSUE_REGEX = re.compile(r"(?:fixes|closes)[\s:]+#(\d+)") | ||
CHERRY_PICK_REGEX = re.compile(r"^\s*\(cherry picked from commit [0-9a-f]*\)\s*$") | ||
try: | ||
CHANGELOG_EXTS = { | ||
f".{item['directory']}" for item in PYPROJECT_TOML["tool"]["towncrier"]["type"] | ||
} | ||
except KeyError: | ||
CHANGELOG_EXTS = {"feature", "bugfix", "doc", "removal", "misc"} | ||
|
||
repo = Repo(".") | ||
|
||
base_commit = repo.commit(sys.argv[1]) | ||
head_commit = repo.commit(sys.argv[2]) | ||
|
||
pr_commits = list(repo.iter_commits(f"{base_commit}..{head_commit}")) | ||
|
||
labels = { | ||
"multi-commit": len(pr_commits) > 1, | ||
"cherry-pick": False, | ||
"no-issue": False, | ||
"no-changelog": False, | ||
"wip": False, | ||
} | ||
for commit in pr_commits: | ||
labels["wip"] |= BLOCKING_REGEX.search(commit.summary) is not None | ||
no_issue = ISSUE_REGEX.search(commit.message, re.IGNORECASE) is None | ||
labels["no-issue"] |= no_issue | ||
cherry_pick = CHERRY_PICK_REGEX.search(commit.message) is not None | ||
labels["cherry-pick"] |= cherry_pick | ||
changelog_snippets = [ | ||
k | ||
for k in commit.stats.files | ||
if k.startswith("CHANGES/") and Path(k).suffix in CHANGELOG_EXTS | ||
] | ||
labels["no-changelog"] |= not changelog_snippets | ||
|
||
print("ADD_LABELS=" + ",".join((k for k, v in labels.items() if v))) | ||
print("REMOVE_LABELS=" + ",".join((k for k, v in labels.items() if not v))) | ||
|
||
|
||
if __name__ == "__main__": | ||
main() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
2021.08.26-380-g46e00a5 | ||
2021.08.26-383-gca51ecf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,13 +62,8 @@ jobs: | |
committer: "pulpbot <[email protected]>" | ||
author: "pulpbot <[email protected]>" | ||
title: "Update CI files for branch main" | ||
body: "" | ||
branch: "update-ci/main" | ||
base: "main" | ||
commit-message: | | ||
Update CI files | ||
[noissue] | ||
delete-branch: true | ||
- uses: "actions/checkout@v4" | ||
with: | ||
|
@@ -89,13 +84,8 @@ jobs: | |
committer: "pulpbot <[email protected]>" | ||
author: "pulpbot <[email protected]>" | ||
title: "Update CI files for branch 0.22" | ||
body: "" | ||
branch: "update-ci/0.22" | ||
base: "0.22" | ||
commit-message: | | ||
Update CI files | ||
[noissue] | ||
delete-branch: true | ||
- uses: "actions/checkout@v4" | ||
with: | ||
|
@@ -116,13 +106,8 @@ jobs: | |
committer: "pulpbot <[email protected]>" | ||
author: "pulpbot <[email protected]>" | ||
title: "Update CI files for branch 0.15" | ||
body: "" | ||
branch: "update-ci/0.15" | ||
base: "0.15" | ||
commit-message: | | ||
Update CI files | ||
[noissue] | ||
delete-branch: true | ||
- uses: "actions/checkout@v4" | ||
with: | ||
|
@@ -143,13 +128,8 @@ jobs: | |
committer: "pulpbot <[email protected]>" | ||
author: "pulpbot <[email protected]>" | ||
title: "Update CI files for branch 0.16" | ||
body: "" | ||
branch: "update-ci/0.16" | ||
base: "0.16" | ||
commit-message: | | ||
Update CI files | ||
[noissue] | ||
delete-branch: true | ||
- uses: "actions/checkout@v4" | ||
with: | ||
|
@@ -170,13 +150,8 @@ jobs: | |
committer: "pulpbot <[email protected]>" | ||
author: "pulpbot <[email protected]>" | ||
title: "Update CI files for branch 0.18" | ||
body: "" | ||
branch: "update-ci/0.18" | ||
base: "0.18" | ||
commit-message: | | ||
Update CI files | ||
[noissue] | ||
delete-branch: true | ||
- uses: "actions/checkout@v4" | ||
with: | ||
|
@@ -197,13 +172,8 @@ jobs: | |
committer: "pulpbot <[email protected]>" | ||
author: "pulpbot <[email protected]>" | ||
title: "Update CI files for branch 0.20" | ||
body: "" | ||
branch: "update-ci/0.20" | ||
base: "0.20" | ||
commit-message: | | ||
Update CI files | ||
[noissue] | ||
delete-branch: true | ||
- uses: "actions/checkout@v4" | ||
with: | ||
|
@@ -224,11 +194,7 @@ jobs: | |
committer: "pulpbot <[email protected]>" | ||
author: "pulpbot <[email protected]>" | ||
title: "Update CI files for branch 0.21" | ||
body: "" | ||
branch: "update-ci/0.21" | ||
base: "0.21" | ||
commit-message: | | ||
Update CI files | ||
[noissue] | ||
delete-branch: true | ||
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# This config represents the latest values used when running the plugin-template. Any settings that | ||
# were not present before running plugin-template have been added with their default values. | ||
|
||
# generated with [email protected]377-g1ba8f46 | ||
# generated with [email protected]382-gc88324b | ||
|
||
api_root: /pulp/ | ||
black: true | ||
|
@@ -26,7 +26,6 @@ flake8_ignore: [] | |
github_org: pulp | ||
latest_release_branch: '0.22' | ||
lint_requirements: true | ||
noissue_marker: '[noissue]' | ||
os_required_packages: [] | ||
parallel_test_workers: 8 | ||
plugin_app_label: ansible | ||
|