Skip to content

fixes #42 - Add a startsWith check to publish-new-release workflow#43

Merged
thomaseizinger merged 2 commits intothomaseizinger:devfrom
jsoberg:jsoberg/#42/adding-startswith-check-to-publish-release
Sep 15, 2022
Merged

fixes #42 - Add a startsWith check to publish-new-release workflow#43
thomaseizinger merged 2 commits intothomaseizinger:devfrom
jsoberg:jsoberg/#42/adding-startswith-check-to-publish-release

Conversation

@jsoberg
Copy link
Copy Markdown
Contributor

@jsoberg jsoberg commented Sep 4, 2022

fixes #42 - Add a startsWith check that verifies the PR being merged in is from a release/<version> branch, skipping the workflow if it is not. This saves us from showing failed workflows for non-release PR merges.

Example of this logic skipping non-release PR merges: https://github.com/jsoberg/Loot-Hoard-DnD-Discord-Bot/actions/runs/2988351427
Example of this logic triggering on release PR merges: https://github.com/jsoberg/Loot-Hoard-DnD-Discord-Bot/actions/runs/2988387989

Verifies that the PR being merged in is from a `release/<version>` branch, skipping the workflow if it is not.
@jsoberg jsoberg changed the title #42 - Add a startsWith check to publish-new-release workflow fixes #42 - Add a startsWith check to publish-new-release workflow Sep 4, 2022
Copy link
Copy Markdown
Owner

@thomaseizinger thomaseizinger left a comment

Choose a reason for hiding this comment

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

Thank you!

Just one minor comment, otherwise this can be merged :)

runs-on: ubuntu-latest
if: github.event.pull_request.merged == true # only merged pull requests must trigger this job
# only merged pull requests that begin with 'release/' must trigger this job
if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/')
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

This will need to handle hotfix/ as well otherwise the code from line 25-31 does not make any sense.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Sorry about that! Updated the check to look for ('release/' || 'hotfix/')

@thomaseizinger
Copy link
Copy Markdown
Owner

Cool, thank you for the contribution!

@thomaseizinger thomaseizinger merged commit ff3ab31 into thomaseizinger:dev Sep 15, 2022
@thomaseizinger
Copy link
Copy Markdown
Owner

Actually, would you mind sending a follow-up PR that adds an entry to the changelog?

@jsoberg
Copy link
Copy Markdown
Contributor Author

jsoberg commented Sep 15, 2022

Oh yeah, no worries!

@jsoberg
Copy link
Copy Markdown
Contributor Author

jsoberg commented Sep 15, 2022

Would drafting a 2.1.0 release be appropriate here, updating the changelog in that PR?

@thomaseizinger
Copy link
Copy Markdown
Owner

Would drafting a 2.1.0 release be appropriate here, updating the changelog in that PR?

We can draft a new release yes! I typically always fixed up the changelog before but the release PR is a good place too!

@thomaseizinger
Copy link
Copy Markdown
Owner

We are still depending on a quite old version of the create-pull-request action here so the workflow is broken :(

Need to update that and probably enable dependabot in this repo.

https://github.com/thomaseizinger/github-action-gitflow-release-workflow/actions/runs/3065049502/jobs/4948757562#step:9:17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Publish-release workflow will run for non-release branches

2 participants