Skip to content

Commit

Permalink
Issue postgres-plr#111 Figure out how to skip ci for non code changes p…
Browse files Browse the repository at this point in the history
…ostgres-plr#111

Note
```
[skip ci] appearing in the "extended description": ignored by Appveyor, read by Github Actions
```
Therefore, this pull request will build on Appveyor.

Appveyor - *.md
https://www.appveyor.com/docs/how-to/filtering-commits/
```
Commit files (GitHub and Bitbucket only)
Skip commits . . .
skip_commits.files allows skipping AppVeyor build
if all of the files modified in push’s head commit match any of the file matching rules.
```

Travis - *.md
https://reflectoring.io/skip-ci-build/
```
script for Travis CI on GitHub and modified it
creates a diff of all commits and exits the build if it only includes markdown files
```
Note, I could not test travis.org.
I am not allowed to add branches.
Travis.org claims to shut down before the end of May.

Github Actions - *.md
https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
```
paths-ignore . . .
When using the push and pull_request events,
you can, configure a workflow to run, when at least one file does not match
paths-ignore, or at least one modified file matches the configured paths.

```
Github Actions - [skip actions]
This custom solution is not restricted by "web hook event payload" ("push", "pull_request")
https://dev.to/epassaro/use-skip-ci-in-github-actions-1mnf
```
If you want to just check the latest commit, change it to:
```
```
if: "!contains(github.event.head_commit.message, '[ci skip]')"
```

Summary of directly asking to skip the build
 * Appveyor                - [skip ci], [skip appveyor]
 * Github Actions (custom) - [skip ci], [skip actions], [skip github actions]
 * Travis                  - [skip ci], [skip travis]

Tested at . .
https://github.com/AndreMikulec/plr/tree/master_no_run_skip_ci_or_only_change_in_md_dev
(eventually) non-runs (ignored runs) at . . .
https://ci.appveyor.com/project/AndreMikulec/plr/history
and (eventually) non-runs (ignored runs) at . . .
https://github.com/AndreMikulec/plr/actions?query=branch%3Amaster_no_run_skip_ci_or_only_change_in_md_dev

Issue Fix postgres-plr#111
  • Loading branch information
AndreMikulec committed May 28, 2021
1 parent 1689332 commit 0b555e1
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 1 deletion.
23 changes: 22 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,23 @@
name: plr CI
on: [push, pull_request]
on:
pull_request:
paths-ignore:
# When using the push and pull_request events,
# you can, configure a workflow to run, when at least one file does not match
# paths-ignore, or at least one modified file matches the configured paths.
- '**/*.md'
push:
paths-ignore:
- '**/*.md'
jobs:
master:
runs-on: ubuntu-latest
# not restricted to specific Webhook event payloads (of "push" and "pull_request")
# just check the latest commit
if: |
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.message, '[skip actions]') &&
!contains(github.event.head_commit.message, '[skip github actions]')
steps:
- name: Echo site details
run: echo building master
Expand Down Expand Up @@ -45,6 +60,12 @@ jobs:

build:
runs-on: ubuntu-latest
# not restricted to specific Webhook event payloads (of "push" and "pull_request")
# just check the latest commit
if: |
!contains(github.event.head_commit.message, '[skip ci]') &&
!contains(github.event.head_commit.message, '[skip actions]') &&
!contains(github.event.head_commit.message, '[skip github actions]')
env:
PG: ${{ matrix.pg }}
strategy:
Expand Down
7 changes: 7 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ env:
- PG=9.5

before_script:
# creates a diff of all commits and exits the build if it only includes markdown files
- |
if ! git diff --name-only $TRAVIS_COMMIT_RANGE | grep -qvE '(.md$)'
then
echo "Only doc files were updated, not running the CI."
exit
fi
- sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
- wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
- sudo apt-get update -qq
Expand Down
9 changes: 9 additions & 0 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@

# Skipping commits affecting specific files (GitHub and Bitbucket only).
skip_commits:
files:
# skipping AppVeyor build if, in the push’s head commit, all of the files
# have the extension .md
- '**/*.md'


image: Visual Studio 2015
configuration: Release
platform: x64
Expand Down

0 comments on commit 0b555e1

Please sign in to comment.