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

[Feature] Compare the Last Remote SHA and Head SHA of a Git Branch? #1006

Closed
2 tasks done
vrathore18 opened this issue Mar 7, 2023 · 2 comments
Closed
2 tasks done
Labels
enhancement New feature or request

Comments

@vrathore18
Copy link

Is this feature missing in the latest version?

  • I'm using the latest release

Is your feature request related to a problem? Please describe.

I have a use case for the "on synchronize" event, which I will illustrate as follows:

I created a pull request with the base branch as "develop" and the current branch as "feature/xyz".
Let's assume the current SHA of the "feature/xyz" branch is SHA 111.
I made changes to "file1.txt" and pushed the changes with a commit SHA of SHA 222.
I was able to detect the change correctly on the "feature/xyz" branch (from SHA 111 to SHA 222).

However, I am facing a challenge now.

Let's assume that I made another change to "file2.txt" on my local machine. I committed my changes but didn't push them (SHA 333).
Then, I made a change to "file3.txt" on my local machine, committed my changes and pushed them (SHA 444).

But when the triggered build checked in, I can only see that the changed file is "file3.txt" because the comparison is between SHA 444 and SHA 333. What I actually need is a comparison between SHA 444 and SHA 222, as SHA 333 was a local commit and came with the SHA 444 push.

Describe the solution you'd like?

In summary, I want to compare the last remote SHA of the current branch (SHA 222) with the head SHA of the current branch (SHA 444)

It is even possible?

Describe alternatives you've considered?

No response

Anything else?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@vrathore18 vrathore18 added the enhancement New feature or request label Mar 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 7, 2023

Thanks for reporting this issue, don't forget to star this project if you haven't already to help us reach a wider audience.

@jackton1
Copy link
Member

jackton1 commented Mar 7, 2023

Hi @vrathore18 I believe this is already supported and can be found in the Usage documentation.

You can achieve this by using

...
    - name: Get changed files
       id: changed-files
       uses: tj-actions/changed-files@v35
       with:
         since_last_remote_commit: true

let me know if you run into any issues or have any questions.

@jackton1 jackton1 closed this as not planned Won't fix, can't repro, duplicate, stale Mar 7, 2023
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