Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: changelog action & example #408

Merged
merged 30 commits into from Mar 12, 2024
Merged

feat: changelog action & example #408

merged 30 commits into from Mar 12, 2024

Conversation

klmcadams
Copy link
Contributor

The changelog action uses towncrier and adds fragments (files) to a directory of your choice based on your pyproject.toml settings for towncrier. Each fragment is named in the format pr_number.pr_label.md. The pr_label is determined by the labels in the pull request. For example, if you have the "enhancement" and "maintenance" labels, it will set the pr_label as "added". This means the fragment will be added to the changelog under the "Added" subsection. Side note - it seems like the majority of PRs have the maintenance label, so that's why I chose to categorize the PR based on other labels other than maintenance.

I think it would make the most sense to put this action at the end of the .github/workflows/label.yml file. For this action to work, you have to add the "types" line under "pull_request:" in label.yml file:

on:
  pull_request:
    # opened, reopened, and synchronize are default for pull_request
    # edited - when PR title or body is changed
    # labeled - when labels are added to PR
    types: [opened, reopened, synchronize, edited, labeled]

labeler:
...

changelog-fragment:
  name: "Create changelog fragment"
  needs: [labeler]
  runs-on: ubuntu-latest
  steps:
    - uses: ansys/actions/doc-changelog@{{ version }}
      with:
        token: ${{ '{{ secrets.GITHUB_TOKEN }}' }}

Here is an example of how to set up your repository to use towncrier/this action: https://github.com/ansys/ansys-templates/compare/demo/changelog-action?expand=1

This action will only create the fragments for the changelog. You will have to run towncrier build --yes --version <version> to create the changelog using these fragments. Here is an example: https://towncrier.readthedocs.io/en/stable/markdown.html

This PR is the same as #357 but has less commits so it would be easier to review. I figured I could go over this with everyone at the team meeting to get everyone's opinions :)

@klmcadams klmcadams requested a review from a team as a code owner February 22, 2024 22:16
@ansys-reviewer-bot
Copy link
Contributor

Thanks for opening a Pull Request. If you want to perform a review write a comment saying:

@ansys-reviewer-bot review

@github-actions github-actions bot added the enhancement New features or code improvements label Feb 22, 2024
@RobPasMue
Copy link
Member

This is great @klmcadams! I will try to review it today

@RobPasMue
Copy link
Member

RobPasMue commented Feb 23, 2024

Just curious - why did we close #357? Commits get squashed and merged anyway.

Copy link
Member

@RobPasMue RobPasMue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from my comments - looks amazing

doc-changelog/action.yml Outdated Show resolved Hide resolved
doc-changelog/action.yml Show resolved Hide resolved
doc-changelog/action.yml Show resolved Hide resolved
doc-changelog/action.yml Show resolved Hide resolved
doc/source/doc-actions/examples/doc-changelog-basic.yml Outdated Show resolved Hide resolved
@RobPasMue
Copy link
Member

@klmcadams - could you add to docs/source/migration_guide.rst this new feature? (not as a breaking change - just new feature)

Explain as well in migration steps the changes needed to make it work.

@klmcadams
Copy link
Contributor Author

Just curious - why did we close #357? Commits get squashed and merged anyway.

I closed it because there were a ton of comments and commits, so I thought it would be easier to review if I started a new PR

Copy link
Member

@RobPasMue RobPasMue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have to discuss the location of all these steps. I don't believe it's a migration guide because it is not a breaking change, but a new feature.

PS.: I know I said "add it to the migration steps guide" in my initial comment, the content is great in any case, let's just discuss where to put it =)

doc-changelog/action.yml Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc/source/migration_guide.rst Outdated Show resolved Hide resolved
doc-changelog/action.yml Outdated Show resolved Hide resolved
doc/source/index.rst Outdated Show resolved Hide resolved
doc/source/index.rst Outdated Show resolved Hide resolved
@klmcadams klmcadams merged commit 0746034 into main Mar 12, 2024
16 checks passed
@klmcadams klmcadams deleted the feat/changelog-action branch March 12, 2024 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New features or code improvements
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants