With Travis CI, we can skip the build for a particular commit with adding a suffix to a commit. This is described at Travis CI. I find this feature practical when I only edit README.md
which is not code-related and the pre-flight build doesn't need to be triggered.
[skip ci]
How do I skip the jobs trigged on: push
events using GitHub Actions?
name: Maven Build on: [push] jobs: build: runs-on: ubuntu-latest steps: - name: Check-out project uses: actions/checkout@v1 - name: Set up JDK 11.0.3 uses: actions/setup-java@v1 with: java-version: 11.0.3 - name: Build with Maven run: mvn -B package --file pom.xml
Answers summary:
Big thanks to all the answerers providing various ways to achieve it. I bet everybody would need something a little bit different regarding to the origin of their problem and the CI approach. Here are the answers listed for a quick navigation:
readme.md
file: https://stackoverflow.com/a/61876395/3764965 [skip ci]
as a new GitHub feature: [skip ci]
message by parsing (customizable solution): All the answers deserve upvote! If you like my question, you should double-like the answers.
To run jobs sequentially, you can define dependencies on other jobs using the jobs. <job_id>. needs keyword. Each job runs in a runner environment specified by runs-on .
You can configure a GitHub Actions workflow to be triggered when an event occurs in your repository, such as a pull request being opened or an issue being created. Your workflow contains one or more jobs which can run in sequential order or in parallel.
Using Jenkins allows you to store your code on any repository be on Github, Gitlab, BitBucket etc. Maturity: Jenkins has been around and is more mature than Github Actions. Github actions are relatively new and as a result, have less community support.
UPDATE: Please accept Helmisek anwser, which points out that Github has the functionality built-in now.
My answer only makes sense, if you want to skip just some jobs/steps.
You can give the following a try:
name: Maven Build on: [push] jobs: build: if: "!contains(github.event.commits[0].message, '[skip ci]')" runs-on: ubuntu-latest steps: - name: Check-out project uses: actions/checkout@v1 - name: Set up JDK 11.0.3 uses: actions/setup-java@v1 with: java-version: 11.0.3 - name: Build with Maven run: mvn -B package --file pom.xml
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With