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

ci: improve release workflows to skip early #198

Merged
merged 2 commits into from
Dec 1, 2022

Conversation

derberg
Copy link
Member

@derberg derberg commented Nov 24, 2022

Description

  • this change will significantly improve GitHub Actions workload as at the moment release workflow is triggered on every single commit, and tests have to go through until semantic-release finds out release is not needed
  • I use startsWith(fromJson and not contains(fromJson like in other workflows because commit message can be multiline, and we do not have 100% assurance that PR was not manually merged and feat/fix was not mentioned somewhere in the message
  • I checked if startsWith also works with contains as there is not direct info in docs, at least I did not find it. I just searched github and found https://github.com/insignias/React/blob/main/.github/workflows/merge-release-pr-to-main.yml#L40

Related issue(s)
Resolves #184

fmvilas
fmvilas previously approved these changes Nov 28, 2022
# "commits" contains array of objects where one of the properties is commit "message"
# Release workflow will be skipped if release conventional commits are not used
if: |
startsWith( github.repository, 'asyncapi/' ) &&
Copy link
Member Author

Choose a reason for hiding this comment

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

to make sure workflow does not run on forks, to not confuse people

I already had few questions from folks asking why release is failing (but it was running on their forks)

# Release workflow will be skipped if release conventional commits are not used
if: |
startsWith( github.repository, 'asyncapi/' ) &&
(startsWith( github.event.commits[0].message , 'fix:' ) ||
Copy link
Member Author

Choose a reason for hiding this comment

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

unfortunately github.event.commits[0].message must be repeated several times. When I added it as global env in workflow, it was not accessed in condition

(startsWith( github.event.commits[0].message , 'fix:' ) ||
startsWith( github.event.commits[0].message, 'fix!:' ) ||
startsWith( github.event.commits[0].message, 'feat:' ) ||
startsWith( github.event.commits[0].message, 'feat!:' ))
Copy link
Member Author

Choose a reason for hiding this comment

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

unfortunately startsWith has to be done this way, it accepts only string as input for evaluation. In case of contains it accepts array.

Copy link
Member Author

@derberg derberg left a comment

Choose a reason for hiding this comment

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

@fmvilas sorry, please approve again. When I was in the sauna yesterday, I was thinking about this workflow and something told me to do some tests on the personal repo. And yeah, as a result, I had to rework the entire condition

@derberg derberg requested a review from fmvilas November 29, 2022 09:23
Copy link
Member

@fmvilas fmvilas left a comment

Choose a reason for hiding this comment

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

Yeah, that makes sense. I mean, the PR, not the sauna thing 😄

@derberg
Copy link
Member Author

derberg commented Dec 1, 2022

/rtm

@asyncapi-bot asyncapi-bot merged commit 57632f4 into asyncapi:master Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

we should add some custom filter to release workflow
3 participants