Skip to content

Commit

Permalink
Merge pull request #142 from jmlopez-rod/hotfix/0.34.1
Browse files Browse the repository at this point in the history
(hotfix) 0.34.1
  • Loading branch information
jmlopez-rod authored May 8, 2024
2 parents e422123 + ca04602 commit abf522d
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 3 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,13 @@ The format of this changelog is based on
## [Unreleased]

## [0.34.1] <a name="0.34.1" href="#0.34.1">-</a> May 08, 2024

- Provide another way to bypass the check for `CHANGELOG.md` when creating a
pull request. We can add `changelog_bypassers` in the `m` configuration to a
list of github usernames that are allowed to bypass the check. this is useful
for bots like `dependabot`.

## [0.34.0] <a name="0.34.0" href="#0.34.0">-</a> May 06, 2024

- We may provide `platforms` in the `m` configuration. This is helpful when we
Expand Down Expand Up @@ -547,7 +554,8 @@ latest on the `master` branch.
- Provides basic utilities to create a CI/CD flow via the m cli.
- As a library, it facilities the creation of clis similar to m.

[unreleased]: https://github.com/jmlopez-rod/m/compare/0.34.0...HEAD
[unreleased]: https://github.com/jmlopez-rod/m/compare/0.34.1...HEAD
[0.34.1]: https://github.com/jmlopez-rod/m/compare/0.34.0...0.34.1
[0.34.0]: https://github.com/jmlopez-rod/m/compare/0.33.1...0.34.0
[0.33.1]: https://github.com/jmlopez-rod/m/compare/0.33.0...0.33.1
[0.33.0]: https://github.com/jmlopez-rod/m/compare/0.32.1...0.33.0
Expand Down
2 changes: 1 addition & 1 deletion m/m.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
owner: jmlopez-rod
repo: m
version: 0.34.0
version: 0.34.1
workflow: m_flow
build_tag_with_version: true
3 changes: 3 additions & 0 deletions packages/python/m/ci/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ class Config(BaseModel):
# If true it will require an update to the changelog for every PR.
require_pr_changelog: bool = True

# List of github logins allowed to bypass the changelog requirement.
changelog_bypassers: list[str] = []

git_flow: GitFlowConfig = GitFlowConfig(
master_branch=Branches.master,
develop_branch=Branches.develop,
Expand Down
4 changes: 3 additions & 1 deletion packages/python/m/ci/git_env.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,11 @@ def get_git_env(config: Config, env_vars: EnvVars) -> Res[GitEnv]:
pr = res.pull_request

if pr and config.require_pr_changelog and not pr.changelog_updated():
can_bypass: bool = bool(config.changelog_bypassers) and pr.author.login in config.changelog_bypassers

# If this is a huge PR we'll bypass it, the file may not be present in
# the list of files.
if pr.file_count < 100:
if not can_bypass and pr.file_count < 100:
return issue('missing CHANGELOG.md in PR', context={'pr': pr.model_dump()})

git_env.sha = res.commit.sha
Expand Down
21 changes: 21 additions & 0 deletions packages/python/tests/ci/release_env/test_m_flow.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,27 @@
workflow=Workflow.m_flow,
),
),
TCase(
desc='pr 1 - no changelog bypassers',
config={'version': '1.1.1', 'changelog_bypassers': ['jmlopez-rod']},
env_vars={'git_branch': 'refs/pull/1'},
gh_res='pr1-no-changelog.json',
release_env=ReleaseEnv(
build_tag='0.0.0-pr1.b404',
python_tag='0.0.0b1.dev404',
is_release=False,
is_release_pr=False,
is_hotfix_pr=False,
workflow=Workflow.m_flow,
),
),
TCase(
desc='pr 1 - no changelog no bypassers',
config={'version': '1.1.1', 'changelog_bypassers': ['dependabot']},
env_vars={'git_branch': 'refs/pull/1'},
gh_res='pr1-no-changelog.json',
err='missing CHANGELOG.md in PR',
),
TCase(
desc='pr 1 - dev versioning',
config={'version': '1.1.1', 'build_tag_with_version': True},
Expand Down

0 comments on commit abf522d

Please sign in to comment.