Skip to content

Commit

Permalink
fix(create-prs-to-update-vcs-repositories): update only for versions …
Browse files Browse the repository at this point in the history
…whose format is `X.Y.Z` (#320)

* fix(create-prs-to-update-vcs-repositories): fix as follows (see below)

  * Only handles formats such as: "1.0.0", "1.1.1", "0.0.9", ... etc
  * Following ones are the mismatched examples:
```
        "v0.0.1",               # mismatch
        "ros2-v0.0.4",          # mismatch
        "xxx-1.0.0-yyy",        # mismatch
        "v1.2.3-beta",          # mismatch
        "v1.0",                 # mismatch
        "v2",                   # mismatch
        "1.0.0-alpha+001",      # mismatch
        "v1.0.0-rc1+build.1",   # mismatch
        "2.0.0+build.1848",     # mismatch
        "2.0.1-alpha.1227",     # mismatch
        "1.0.0-alpha.beta",     # mismatch
        "ros_humble-v0.10.2"    # mismatch
```

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): fix a wrong match method

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): fix README.md

  * Make clear what is the condition for creating a PR

Signed-off-by: Junya Sasaki <[email protected]>

* style(pre-commit): autofix

* fix(create-prs-to-update-vcs-repositories): specify language for fenced code block

Signed-off-by: Junya Sasaki <[email protected]>

* style(pre-commit): autofix

* fix(create-prs-to-update-vcs-repositories): fix wrongly saved README.md

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): fix wrong plaintext annotation

Signed-off-by: Junya Sasaki <[email protected]>

* style(pre-commit): autofix

Signed-off-by: Junya Sasaki <[email protected]>

* Update create-prs-to-update-vcs-repositories/README.md

Co-authored-by: Ryohsuke Mitsudome <[email protected]>
Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): fixes in semver (see below):

  * Do not allow to change the semver pattern via argument: use only fixed pattern.
  * Add description to make it explicit what kind of patterns are supported.

Signed-off-by: Junya Sasaki <[email protected]>

* feat(create-prs-to-update-vcs-repositories): support release types (see below):

  * Support separated PRs for major, minor, and patch updates
  * If not specified, PR will be created for any updates

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): ignore a word "devrelease" from spell check

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): apply missing updates

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): bug fix (see below):

  * The existing branch list is not updated correctly.
    When major, minor, patch, and any are all enabled,
    The same name branch can be processed twice.
    This eventually causes an error like:
```
nothing to commit
```

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): cosmetic fix

  * The information is duplicated that of README.md

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): fix code duplication

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): cosmetic fix

  * Keep consistent indentation

Signed-off-by: Junya Sasaki <[email protected]>

* fix(create-prs-to-update-vcs-repositories): fix a yamllint bug

Signed-off-by: Junya Sasaki <[email protected]>

---------

Signed-off-by: Junya Sasaki <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Ryohsuke Mitsudome <[email protected]>
  • Loading branch information
3 people authored Oct 1, 2024
1 parent 77faadb commit e1102ae
Show file tree
Hide file tree
Showing 3 changed files with 209 additions and 115 deletions.
47 changes: 47 additions & 0 deletions create-prs-to-update-vcs-repositories/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ jobs:
token: ${{ steps.generate-token.outputs.token }}
repo_name: autowarefoundation/autoware
parent_dir: .
targets: major minor
base_branch: main
new_branch_prefix: feat/update-
autoware_repos_file_name: autoware.repos
Expand All @@ -49,6 +50,7 @@ jobs:
| ------------------------ | -------- | -------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| token | true | | The token for pull requests. |
| repo_name | true | | The name of the repository to create pull requests. |
| targets | false | any | The target release types (choices: any, patch, minor, major). |
| parent_dir | false | . | The parent directory of the repository. |
| base_branch | false | main | The base branch to create pull requests. |
| new_branch_prefix | false | feat/update- | The prefix of the new branch name. The branch name will be `{new_branch_prefix}-{user_name}/{repository_name}/{new_version}`. |
Expand All @@ -58,3 +60,48 @@ jobs:
## Outputs

None.

## What kind of tags are handled?

- Monitors all vcs-imported repositories in the `autoware.repos` (if default) which have a version with regular expression pattern `r'\b(?<![^\s])\d+\.\d+\.\d+(?![-\w.+])\b'`.
- This pattern match/mismatches for the following examples:

```plaintext
"0.0.1", # match
"0.1.0", # match
"1.0.0", # match
"2.1.1", # match
"v0.0.1", # mismatch
"ros2-v0.0.4", # mismatch
"xxx-1.0.0-yyy", # mismatch
"v1.2.3-beta", # mismatch
"v1.0", # mismatch
"v2", # mismatch
"1.0.0-alpha+001", # mismatch
"v1.0.0-rc1+build.1", # mismatch
"2.0.0+build.1848", # mismatch
"2.0.1-alpha.1227", # mismatch
"1.0.0-alpha.beta", # mismatch
"ros_humble-v0.10.2" # mismatch
```

## What kind of version update is possible?

- If there is a new version with pattern matched in the vcs-imported repositories, create a PR for each repository, respectively.
- The valid/invalid version update cases are as follows:
- Valid ones (PR must be created):

```plaintext
0.0.1 => 0.0.2 # If `--target patch` or `--target any` is specified
1.1.1 => 1.2.1 # If `--target minor` or `--target any` is specified
2.4.3 => 3.0.0 # If `--target major` or `--target any` is specified
```

- Invalid ones (PR is not created):

```plaintext
main => 0.0.1
v0.0.1 => 0.0.2
xxx-0.0.1 => 0.0.9
0.0.1-rc1 => 0.0.2
```
5 changes: 5 additions & 0 deletions create-prs-to-update-vcs-repositories/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ inputs:
description: Parent directory
required: false
default: ./
targets:
description: Target release types
required: false
default: any
base_branch:
description: Base branch
required: false
Expand Down Expand Up @@ -63,6 +67,7 @@ runs:
python ${GITHUB_ACTION_PATH}/create_prs_to_update_vcs_repositories.py \
--repo_name ${{ inputs.repo_name }} \
--parent_dir ${{ inputs.parent_dir }} \
--targets ${{ inputs.targets }} \
--base_branch ${{ inputs.base_branch }} \
--new_branch_prefix ${{ inputs.new_branch_prefix }} \
--autoware_repos_file_name ${{ inputs.autoware_repos_file_name }} \
Expand Down
Loading

0 comments on commit e1102ae

Please sign in to comment.