Skip to content

Ref: Skip CI for commits without code changes #17

Ref: Skip CI for commits without code changes

Ref: Skip CI for commits without code changes #17

Workflow file for this run

name: Skip CI
on:
pull_request:
jobs:
check-ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Check diff from Pull Request
run: |
skipList=(".github/codeowners")
# Ignores changelog.md, readme.md,...
fileChangesArray=($(git diff --name-only origin/${{ github.base_ref }}..origin/${{ github.head_ref }} | grep -v '\.md$'))
echo ${fileChangesArray}
for item in "${fileChangesArray[@]}"
do
if [[ ! " ${skipList[@]} " =~ " ${item} " ]]; then
#found an item that doesn't belong to the skip list.
exit 0
fi
done
echo "{skip_ci}=true >> $GITHUB_ENV"