From d29b009bfea760f72e058c9aaae921810e118483 Mon Sep 17 00:00:00 2001 From: Remo Senekowitsch Date: Sat, 25 Nov 2023 12:39:16 +0100 Subject: [PATCH] wip --- .github/workflows/no-important-files-changed.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/no-important-files-changed.yml b/.github/workflows/no-important-files-changed.yml index 82f609155..e78b0ef7d 100644 --- a/.github/workflows/no-important-files-changed.yml +++ b/.github/workflows/no-important-files-changed.yml @@ -1,7 +1,7 @@ name: No important files changed on: - pull_request_target: + pull_request: types: [opened] paths: - "exercises/*/*/tests/**" @@ -22,7 +22,14 @@ jobs: env: TARGET_BRANCH: ${{ github.base_ref }} run: | - for changed_file in $(git diff --name-only $TARGET_BRANCH); do + set -x + # fetch a ref to the target branch so we can diff against it + git remote set-branches origin '*' + git fetch --depth 1 origin $TARGET_BRANCH + git log --oneline --graph --all -n10 + git diff --name-only $TARGET_BRANCH || true + git diff --name-only origin/$TARGET_BRANCH || true + for changed_file in $(git diff --name-only origin/$TARGET_BRANCH); do if ! echo "$changed_file" | grep --quiet --extended-regexp 'exercises/(practice|concept)' ; then continue fi @@ -62,3 +69,7 @@ jobs: repo: context.repo.repo, body: body }) + + - name: Sanity check + if: steps.check.outputs.important_files_changed == 'false' + run: echo "No important files changed"