Skip to content

Commit

Permalink
chore(rewrite-existing): comment with PR changes
Browse files Browse the repository at this point in the history
to prevent empty comments on reworks
  • Loading branch information
Anis Campos committed Oct 21, 2022
1 parent 1bd89d2 commit bff456d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 3 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/validate_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ jobs:
uses: actions/checkout@v3
with:
fetch-depth: 0
- run: |
# create the master branch
git branch ${{ github.base_ref }} origin/${{ github.base_ref }}
# create the pr branch
git branch ${{ github.head_ref }} origin/${{ github.head_ref }}
- name: Generate changelog
id: generate_changelog
uses: ./
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
path_filters: "changelog_generator/"
target: ${{ github.base_ref }}..${{ github.head_ref }}
- uses: kanga333/comment-hider@bbdf5b562fbec24e6f60572d8f712017428b92e0
name: Hide previous comments
with:
Expand Down
5 changes: 4 additions & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ inputs:
This can be used to keep only relevant commits by filtering on relevant files.
Example:
path_filters: "src/ doc/ tests/*/qa/*"
target:
description: A rev1..rev2 string to be used to generate the commit list
outputs:
changelog:
description: 'The generated changelog'
Expand Down Expand Up @@ -52,7 +54,8 @@ runs:
# generate the change log
CHANGELOG=$(python3 -m changelog_generator \
--tag_prefix ${{ inputs.tag_prefix }} \
--path_filters ${{ inputs.path_filters }}
--path_filters ${{ inputs.path_filters }} \
--target ${{ inputs.target }}
)
# truncate the release note to not bloat the 65536 bytes max limit
Expand Down
13 changes: 11 additions & 2 deletions changelog_generator/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,22 @@ def main() -> None:
nargs="*", # optional list
help="Filter commits with this semicolon separated git path regex",
)

parser.add_argument(
"--target",
nargs="?", # optional argument
help="A rev1..rev2 string to be used to generate the commit list",
)
args = parser.parse_args()
#
prefix = args.tag_prefix or os.environ.get("TAG_PREFIX")
filter_paths = args.path_filters

changelog = generate(repository_path="./", prefix=prefix, filter_paths=filter_paths)
changelog = generate(
repository_path="./",
prefix=prefix,
filter_paths=filter_paths,
target=args.target,
)
print(changelog)


Expand Down

0 comments on commit bff456d

Please sign in to comment.