Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: replaced dorny/path-filter to tj-actions/changed-files #11630

Merged
merged 3 commits into from
Mar 18, 2025

Conversation

JagjeevanAK
Copy link
Contributor

Hey @stephanegigandet and @alexgarel, we finally made it! 🎉

I've tested this solution in my local repo, so there won't be any further excuses. I just want to clarify that the issue last time wasn't with the merge file solution — that was correct. The real problem was with the dorny/path-filter action, which turned out to be buggy.

I've now switched to tj-actions/changed-files, which works perfectly and is well-maintained. ✅

@JagjeevanAK JagjeevanAK requested a review from a team as a code owner March 17, 2025 17:12
@github-actions github-actions bot added the GitHub Actions Pull requests that update Github_actions code label Mar 17, 2025
@codecov-commenter
Copy link

codecov-commenter commented Mar 17, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 49.88%. Comparing base (e8deee5) to head (3d045cd).
Report is 6 commits behind head on main.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #11630   +/-   ##
=======================================
  Coverage   49.88%   49.88%           
=======================================
  Files          83       83           
  Lines       22984    22984           
  Branches     5508     5508           
=======================================
  Hits        11466    11466           
  Misses      10121    10121           
  Partials     1397     1397           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@JagjeevanAK JagjeevanAK enabled auto-merge (squash) March 18, 2025 05:56
Copy link
Contributor

@stephanegigandet stephanegigandet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks

@JagjeevanAK JagjeevanAK merged commit 2863221 into main Mar 18, 2025
15 checks passed
@JagjeevanAK JagjeevanAK deleted the JagjeevanAK/CI_updates branch March 18, 2025 08:20
@stephanegigandet
Copy link
Contributor

Seems to work well :)

I refreshed #11621 after merging the PR, and the tests were skipped:

image

@JagjeevanAK
Copy link
Contributor Author

Hey @stephanegigandet, I tested everything on my personal repo yesterday, and it should work in all aspects. If there's an extreme case where it fails for that, I'm here to resolve it.

@jayaddison
Copy link
Contributor

@JagjeevanAK @alexgarel @stephanegigandet if I understand correctly, the reason for this is that it is not possible to use the GitHub Actions workflows paths and paths-ignored feature in combination with GitHub Actions CI Required Status (in other words: require success) checks, as described in the comment here:

# we can't do that, because status are required
# see https://stackoverflow.com/questions/66751567/return-passing-status-on-github-workflow-when-using-paths-ignore
# paths-ignore:
# - "**.md"
# - ".github/CODEOWNERS"
# - ".github/PULL_REQUEST_TEMPLATE.md"
# - ".editorconfig"

However: previously there was a GitHub-documented workaround for that -- the advice has disappeared from GitHub's documentation some time since Y2023 (now the page redirects to one that does not mention it).

The Y2023 copy (that the poster in the linked discussion was referring to when they posted) can today be found at: https://web.archive.org/web/20230321195500/https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks

The workaround was to create one paths-ignore: x entry, and then an inverted separate workflow -- with a job with the same name -- that has paths: x that always() succeeds.

Is that workaround not possible any more?

@jayaddison
Copy link
Contributor

However: previously there was a GitHub-documented workaround for that -- the advice has disappeared from GitHub's documentation some time since Y2023 (now the page redirects to one that does not mention it).
...
The workaround was to create one paths-ignore: x entry, and then an inverted separate workflow -- with a job with the same name -- that has paths: x that always() succeeds.

Is that workaround not possible any more?

I have begun testing this in openculinary#1. So far, if my experiments are correct, it seems that the workaround remains feasible.

@JagjeevanAK
Copy link
Contributor Author

I've never heard of a workaround, but what I mean is that the actions I've used are widely adopted and actively maintained. If you check their repositories, you'll see their high level of activity.

Additionally, we're currently using tj-actions/changed-files to skip unnecessary Docker builds and optimize our existing CI operations. So in some way they are helping more than a one thing.

@jayaddison
Copy link
Contributor

The workaround - previously a documented solution according to GitHub - would allow us to enable paths and paths-ignore, meaning that we do not need to use a third-party action. The tj-actions/changed-files action experienced a security incident recently, so it may be worth being cautious about it.

@jayaddison
Copy link
Contributor

As a followup to my previous comments: it seems the built-in paths feature from GitHub Actions itself is not sufficient here; we want the ability to filter individual job steps.

I'm trying to work out what the blockers for usage of dorny/paths-filter were; I've learned from discussion in #11644 that it is due to something about that action not behaving as documented. My first guess is that it is this comment:

https://github.com/dorny/paths-filter/blob/9b7572ffb2cddcbb0397d8a240c253352a845140/README.md?plain=1#L205

    steps:
    # For pull requests it's not necessary to checkout the code
    - uses: dorny/paths-filter@v2

Although that may have been true at the time it was written, I don't think it remains true today. I believe that GHA workflows activated by the pull_request event do need to perform a checkout for subsequent steps to be able to use the content of the repo.

I will begin experimenting with using dorny/paths-filter in a fork, using pull requests, and testing what the behaviour is with/without an actions/checkout step beforehand.

@jayaddison
Copy link
Contributor

I will begin experimenting with using dorny/paths-filter in a fork, using pull requests, and testing what the behaviour is with/without an actions/checkout step beforehand.

The logic expressed in #11555 seems to neatly express what we want, and it uses the dorny/paths-filter action; that's approximately the baseline/GHA workflow definition that I will commence testing from.

@JagjeevanAK
Copy link
Contributor Author

Glob characters are not working as they are intended to work as given in doc's.

@JagjeevanAK
Copy link
Contributor Author

Mate #11555 has some logic error's so we reverted it back and then I have solved that problem by creating another PR. you can take look at it.

@jayaddison
Copy link
Contributor

Ok, cool, I've looked at those PRs. Was it the ! (not) globs that were the problem? Files appearing modified even with those added?

@jayaddison
Copy link
Contributor

Again: I should answer my own question! I'll use a fork to check.

@jayaddison
Copy link
Contributor

Ok, I think I have confirmed: the predicate-quantifier setting in dorny/paths-filter does not appear to function as documented. Even after enabling that, a ! blob to ignore some files did not result in the filter having a false value when those files were modified.

For anyone curious, my testing for this was two comparative pull requests at:

@jayaddison
Copy link
Contributor

Hold on! We were using dorny/paths-filter@v2!

The predicate-quantifier feature only arrived for dorny/paths-filter@v3: dorny/paths-filter@cf89abd

@jayaddison
Copy link
Contributor

@JagjeevanAK if the problem in #11555 was that the ignore blobs (!...) did not work, then I think that two small fixups could resolve that:

  • Upgrade from dorny/paths-action version v2 to v3.
  • Configure predicate-quantifier: 'every' on the filter rule -- so that all of the blobs in it have to match.

I've been testing that using the following fork PR, and it was successful:

However, if the problem was something else -- let me know and I can investigate.

jayaddison added a commit to openculinary/openfoodfacts-server that referenced this pull request Mar 27, 2025
jayaddison added a commit to openculinary/openfoodfacts-server that referenced this pull request Mar 27, 2025
In openfoodfacts#11624 the original plan was to
add some negative matching blobs using `paths-filter`, but that did
not function as intended.

As a result of that, we switched to use `tj-actions/paths-filter`
instead, in pull requests openfoodfacts#11630 and openfoodfacts#11644.

The reason `changed-files` did not work as expected is/was the lack
of dorny/paths-filter#224 - a feature only available from v3.0.2
onwards.

This changeset enables support for the `predicate-quantifier` setting
and configures it for the negative-blob matches on the `code`
fileset.
john-gom pushed a commit that referenced this pull request Mar 29, 2025
<!-- IMPORTANT CHECKLIST
Make sure you've done all the following (You can delete the checklist
before submitting)
- [ ] PR title is prefixed by one of the following: feat, fix, docs,
style, refactor, test, build, ci, chore, revert, l10n, taxonomy
- [ ] Code is well documented
- [ ] Include unit tests for new functionality
- [ ] Code passes GitHub workflow checks in your branch
- [ ] If you have multiple commits please combine them into one commit
by squashing them.
- [ ] Read and understood the [contribution
guidelines](https://github.com/openfoodfacts/openfoodfacts-server/blob/main/CONTRIBUTING.md)
-->


Hey @stephanegigandet and @alexgarel, we finally made it! 🎉    

I've tested this solution in my local repo, so there won't be any
further excuses. I just want to clarify that the issue last time wasn't
with the merge file solution — that was correct. The real problem was
with the `dorny/path-filter` action, which turned out to be buggy.

I've now switched to `tj-actions/changed-files`, which works perfectly
and is well-maintained. ✅
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GitHub Actions Pull requests that update Github_actions code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants