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

Scheduled build always running even if no change in filter path #213

Open
mallikkml opened this issue Jan 19, 2024 · 4 comments
Open

Scheduled build always running even if no change in filter path #213

mallikkml opened this issue Jan 19, 2024 · 4 comments

Comments

@mallikkml
Copy link

Here is the log of github action:

Run dorny/paths-filter@v2
Get current git ref
**Warning: 'before' field is missing in event payload - changes will be detected from last commit**
Change detection in last commit
Detected 668 changed files
Results:
**Filter changed = true
Changes output set to ["changed"]**

Is there a way to fix this?

@dorny
Copy link
Owner

dorny commented Jan 27, 2024

@mallikkml I could give you a better answer if you add a relevant part of your workflow file.

In general, this warning means the action is set to detect changes against the same branch. However the event that triggered the workflow is not a "push" event with a "before" field. That field normally provides information about the last commit on the branch before the new commits were pushed. So on a best-effort basis, the action detected changes only from the last commit in the git history, which might not be what you want.

@dorny
Copy link
Owner

dorny commented Jan 27, 2024

@mallikkml I just remembered about a similar issue from a long time ago. Please look at this issue: #100

Summary - there's no sensible default as to how this action should behave for scheduled builds. You have to detect changes against some other branch/tag or provide it commit sha you figure out yourself.

What would be the desired behavior in your case?

@jsoref
Copy link
Contributor

jsoref commented Jan 28, 2024

I'd argue the best behavior would be since the last time the same workflow ran for the same event.

So, if .github/workflows/test.yml ran for on: schedule 3 days ago and is running now, the changes should be between the commit that it ran 3 days ago and the commit it's running on now.

I think that's technically a calculable thing. (It obviously requires permissions:actions:read)

It might not be easy, but it's defensible.

n.b. I don't intend to use this feature, I'm currently answering someone else's complaint about a github feature and I gave up and suggested this action because I needed to suggest something, so now I'm reviewing its open issues.

@mallikkml
Copy link
Author

@dorny Thanks for sharing all the details, I had gone through issue: #100

My understanding is base value is missing for scheduled builds, due to this main seems to be considered as base and this is leading filter to return change as true.

I am looking for a solution or workaround to overcome on this and filter to return true only when there is a change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants