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

Add head ref as input #79

Closed
gagle opened this issue Apr 1, 2021 · 8 comments
Closed

Add head ref as input #79

gagle opened this issue Apr 1, 2021 · 8 comments
Labels
enhancement New feature or request

Comments

@gagle
Copy link

gagle commented Apr 1, 2021

I would like to pass also the head ref as parameter. I have several workflows that listens to workflow_dispatch and repository_dispatch and I need to filter files by path given a head and base ref.

@dorny dorny added the enhancement New feature or request label Apr 7, 2021
@dorny
Copy link
Owner

dorny commented Apr 7, 2021

With workflow_dispatch you define the branch receiving the trigger. I'm not 100% sure but I would expect it should already work. Unless you need to have different head ref then the branch where workflow runs...

However to support repository_dispatch I will have to do some changes. I will look into it.

@dorny
Copy link
Owner

dorny commented Apr 7, 2021

I got it working on branch issue-79-add-head-ref-input.
However I still have to do some tests before merging it to ensure it doesn't break anything else.

@gagle
Copy link
Author

gagle commented Apr 8, 2021

Thanks a lot. We will be using it at the Seat car manufacturer company 👍🏻 . I had to implement my own action based on yours. Used in a gitflow implementation using github actions.

@dorny
Copy link
Owner

dorny commented Apr 11, 2021

So there is a chance I could get a discount when buying Seat car? 😄

Just joking, I'm happy that this action is useful for others.
I've just released new version with ref input parameter implemented so I'm closing the issue now.

@dorny dorny closed this as completed Apr 11, 2021
@gagle
Copy link
Author

gagle commented Apr 15, 2021

I've seen that you now switched to 3 diff dots instead of 2. Why? @dorny

Edit: I've checked this https://matthew-brett.github.io/pydagogue/git_diff_dots.html

@dorny
Copy link
Owner

dorny commented Apr 15, 2021

No, 3 diff dots had been used for a long time (see #33 ). Maybe you misinterpreted the changes?

Explanation:

  • With 2 diff dots you get exact diff between two snapshots (commits).
  • With 3 diff dots you see what has been changed on your (feature) branch since it diverged from your base branch

3 diff dots is what you see when you create a PR.
Otherwise diff would contain also changes on base unrelated to work on feature branch.
That's why this action is fetching more commits until it founds merge-base - the point where feature and base branch diverged.
I'm using 2 diff dots only in some cases - e.g. when you are comparing two commits on same branch after push event.

@gagle
Copy link
Author

gagle commented Apr 15, 2021

Thanks for the explanation. This action it's basically the piece that enables monorepos to build/lint/deploy only specific parts of the system. I would like to use it to build another actions that are based on path filtering. I've tried to npm install it but it's not in the npm registry. Do you think it would require a lot of effort to also convert it into a reusable npm lib? I'm interested in getting all the files that changed between 2 commits to later process them. I'm currently checking out both commits and appplying a 3-dot diff. This action is a lot more battle-tested and I would like to reuse your code to get this file list.

@dorny
Copy link
Owner

dorny commented Apr 19, 2021

Extracting functionality related to fetching into the npm package is quite an interesting idea. It should probably contain only parts using git commands and not depending on GitHub APIs. I can't give you any promises when it will be done, but I like the idea.

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

No branches or pull requests

2 participants