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

Use path filter for GH actions #1244

Closed
philipphofmann opened this issue Jan 25, 2023 · 4 comments · Fixed by #1763
Closed

Use path filter for GH actions #1244

philipphofmann opened this issue Jan 25, 2023 · 4 comments · Fixed by #1763

Comments

@philipphofmann
Copy link
Member

philipphofmann commented Jan 25, 2023

Description

When opening #1239, which only touches the PR request template, I noticed that GH actions run almost all checks, which is unnecessary.

We can use path filters for some of the workflows like flutter.yml or e2e_dart.yml to avoid unneeded GH action runs.

You can have a look at Cocoa 1, Cocoa 2 for reference

@marandaneto
Copy link
Contributor

We do have a few path filters, but indeed, they can be improved, thanks @philipphofmann

@denrase
Copy link
Collaborator

denrase commented Oct 9, 2023

@philipphofmann I have two questions where you hopefully have more experience than me:

First

All of our PRs are set on pull_request. According to GitHub documentation, paths should not be used in those cases, as the PRs would get stuck in a pending state.

Should we still use them? And if so, do we need to change the trigger from pull_request?

Second

Also, we do use multiple paths-ignore. For example, file looks like this:

pull_request:
  paths-ignore:
    - "**/*.md"
    - "logging/**"
    - "flutter/**"
    - "dio/**"
    - "sqflite/**"

The behaviour per GitHub documentation:

When all the path names match patterns in paths-ignore, the workflow will not run. If any path names do not match patterns in paths-ignore, even if some path names match the patterns, the workflow will run.

So that is the reason why your change to .github/pull_request_template.md triggered all the workflows, as it was a match outside of the provided ignores?

Conclusion

Would you agree that, assuming we can use paths regardless of the first point, we should move to the includes rather than using the ignores?

@philipphofmann
Copy link
Member Author

All of our PRs are set on pull_request. According to GitHub documentation, paths should not be used in those cases, as the PRs would get stuck in a pending state.

Only if you have required checks. On Cocoa, we don't because we want to be able to merge changelog changes quickly, for example.

So that is the reason why your change to .github/pull_request_template.md triggered all the workflows, as it was a match outside of the provided ignores?

I think so, yes.

Without looking into all GH actions properly, I can't tell you which configuration you should use exactly. The goal should be that you only run the jobs that make sense. For example, for a Changelog entry change, GH actions shouldn't run all workflows for a PR. Our changelog changes only run four checks; see getsentry/sentry-cocoa#3334. We achieve this by using path filters for PRs. Please choose whatever makes for this repo. @denrase, does that help you, or do you need further info?

@kahest kahest moved this from Backlog to Todo in Mobile & Cross Platform SDK Oct 23, 2023
@denrase denrase mentioned this issue Nov 28, 2023
6 tasks
@denrase
Copy link
Collaborator

denrase commented Nov 28, 2023

@philipphofmann Thank you for your insights, finally came around to take a look at this. 🙇

@denrase denrase moved this from Todo to In Progress in Mobile & Cross Platform SDK Nov 28, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Mobile & Cross Platform SDK Dec 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants