False positive on no important files changed

Add `nth-prime` by BNAndras · Pull Request #405 · exercism/racket · GitHub is a PR to add a new practice exercise. No existing important files were changed, but the GHA check found recent changes to other repo files per Fix robot-name tests by timgott · Pull Request #403 · exercism/racket · GitHub that hadn’t been synced to my fork.

Is there a way we can check just the changed files in the PR instead of across the entire branch?

Interesting! One that @ErikSchierboom will probably enjoy solving when he’s back around.

1 Like

To be honest, not really! Fixing GHA stuff is not really that fun, but I’ll have a look.

2 Likes

We’re using the following code in the workflow:

- name: Checkout code
        uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938
        with:
          repository: ${{ inputs.repository }}
          ref: ${{ inputs.ref }}

- name: Check if important files changed
        id: check
        run: |
          set -exo pipefail

          git remote set-branches origin main
          git fetch --depth 1 origin main

          git diff --diff-filter=M --name-only origin/main

Looking in the log, it seems that the origin remote is set to your fork:

From https://github.com/BNAndras/exercism-racket
 * branch            main       -> FETCH_HEAD
 * [new branch]      main       -> origin/main
+ git diff --diff-filter=M --name-only origin/main

I’ve created Use explicit upstream branch by ErikSchierboom · Pull Request #195 · exercism/github-actions · GitHub. @BNAndras could you temporarily change .github/workflows/no-important-files-changed.yml to use

uses: exercism/github-actions/.github/workflows/check-no-important-files-changed.yml@use-explicit-upstream

instead of

uses: exercism/github-actions/.github/workflows/check-no-important-files-changed.yml@main

Once this change is in main, could you then open some PRs to see if everything works as expected?

Okay, I pushed it through on the Pyret track repo. I triggered the no important files changed workflow on Test of no important changes workflow by BNAndras · Pull Request #230 · exercism/pyret · GitHub. Then I went back to my local repo, went back one commit, and tweaked a non-important file without syncing first. I opened Test if important file triggered by BNAndras · Pull Request #231 · exercism/pyret · GitHub with that change, and the no important files changed PR didn’t trigger. So I think this worked.

Thanks for testing. I’ve merged the PR.

1 Like