Function for not publishing on given merges to master?
trygve-lie opened this issue · comments
Can we somehow make it so its possible to exclude certain merges?
What I am looking into doing is having an automatic publish when there are code / doc / dependency changes, but not doing a publish when ex dev dependencies is updated from a bot like Renovate or Greenkeeper.
If the difference is based on the files changed you should just be able to use filtering in the actions themselves.
For something like only devDependencies changes that would be more difficult. It should certainly be possible, using either action filters or adding code to merge-release
, to exclude commits from PR’s with specific labels which would work for greenkeeper PR’s.
Did a little digging, this is all a bit dependent on your complete workflow.
- You can filter specific files out of an action triggered by push or pull_request.
- You can also add specific
if
statements in steps based on thepull_request
metadata if you use that event as a trigger, this should work well for filtering out PR’s with specific labels. Note: this means you won’t be releasing pushes to master but only successful PR’s.
As far as excluding very specific things, like if only the devDeps were changed, what you may want to do is write a Node.js script that will pass/fail based on this specific logic and publish it to npm as a CLI. You can then use npx
in a shell call inside run
in order to do the filter and overwrite the default action, making the entrypoint.sh
only run when the filter is true.
- run: |
if [ npx trygveShouldPublish ]; then
./entrypoint.sh
fi