6

I have set up an action to be triggered on every push, but its steps to exit if the commit message doesn't conform to a specific pattern. This commit basically points to a new release, and occurs only on the master branch.

However, when after a new release, a new branch is forked from master and pushed to origin without any further commits, that action is triggered again.

Is there any way to specify that the action should not be triggered on pushing a new branch, but rather only fresh commits?

Workflow snippet:

name: Release APK on: push jobs: build: if: "contains(github.event.head_commit.message, 'apkRelease@@')" name: Build APK <...trimmed rest of the yaml> 

With this, when say commit C with message "apkRelease@@ver123" is pushed in master to correspond to a new release, the Build APK step would be triggered. But then if I fork a new dev branch and push it to origin without any commits, the action and step will be triggered again. This I want to prevent.

1 Answer 1

-1

It seems you should just filter for master branch since you're looking at the head commit message to know when to run your step. This means this workflow will only be triggered when merging a commit to master branch so even if a new user creates a different branch then it won't run as it doesn't match the branch filter.

on: push: branches: - master jobs: build: if: "contains(github.event.head_commit.message, 'apkRelease@@')" name: Build APK 
Sign up to request clarification or add additional context in comments.

1 Comment

I cant fix a branch unfortunately.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.