Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions .github/workflows/skip-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,18 @@ jobs:
diff_check:
runs-on: ubuntu-latest
continue-on-error: true
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
BASE_REF: ${{ github.base_ref }}
HEAD_REF: ${{ github.head_ref }}
outputs:
skip_ci:
${{ steps.check_diff.outputs.skip_ci }}
steps:
- name: Check if is PR
id: check-pr
run: |
if [ -z "${{ github.event.pull_request.number }}" ] || [ -z "${{ github.base_ref }}" ] || [ -z "${{ github.head_ref }}" ]; then
if [ -z "$PR_NUMBER" ] || [ -z "$BASE_REF" ] || [ -z "$HEAD_REF" ]; then
echo "This action is intended to be run on pull requests only."
echo "is-pr=false" >> $GITHUB_OUTPUT
else
Expand All @@ -34,16 +38,16 @@ jobs:
- name: Checkout PR Head Branch
if: steps.check-pr.outputs.is-pr == 'true'
run: |
git fetch origin pull/${{ github.event.pull_request.number }}/head:${{ github.head_ref }}
git checkout ${{ github.head_ref }}
git fetch origin "pull/$PR_NUMBER/head:$HEAD_REF"
git checkout "$HEAD_REF"

- name: Check diff from Pull Request
if: steps.check-pr.outputs.is-pr == 'true'
id: check_diff
run: |
skipList=(".github/CODEOWNERS" ".prettierignore")
# Ignores changelog.md, readme.md,...
fileChangesArray=($(git diff --name-only ${{ github.base_ref }}...${{ github.head_ref }} | grep -v '\.md$' || true))
fileChangesArray=($(git diff --name-only "$BASE_REF...$HEAD_REF" | grep -v '\.md$' || true))
printf '%s\n' "${fileChangesArray[@]}"
for item in "${fileChangesArray[@]}"
do
Expand Down
Loading