PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, October 9, 2022

[FIXED] How to skip GitHub Actions job on push event?

 October 09, 2022     continuous-integration, git, github, github-actions, jobs     No comments   

Issue

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:

  • Skip CI on readme.md file: https://stackoverflow.com/a/61876395/3764965
  • Skip CI on [skip ci] as a new GitHub feature:
    • https://stackoverflow.com/a/66156840/3764965 (answer here)
    • https://stackoverflow.com/a/66114678/3764965 (answer in another question)
  • Skip CI on [skip ci] message by parsing (customizable solution):
    • https://stackoverflow.com/a/59775665/3764965
  • Allow CI per specific branch: https://stackoverflow.com/a/61876395/3764965

All the answers deserve upvote! If you like my question, you should double-like the answers.


Solution

Also, for files and directories you want ignored on all pushes you can configure the workflow itself:

on:
  push:
    paths-ignore:
    - 'README.md'


Answered By - oliverbarnes
Answer Checked By - Pedro (PHPFixing Volunteer)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing