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

fix: fix issue when action run on main #2236

Merged
merged 8 commits into from
Oct 24, 2024
Merged

fix: fix issue when action run on main #2236

merged 8 commits into from
Oct 24, 2024

Conversation

jleach
Copy link
Member

@jleach jleach commented Oct 24, 2024

When run on main the diff can not be agains the same ref.

Signed-off-by: Jason C. Leach <[email protected]>
@jleach jleach enabled auto-merge (squash) October 24, 2024 19:58
Signed-off-by: Jason C. Leach <[email protected]>
@jleach jleach changed the title fix: debug action fix: fix issue when action run on main Oct 24, 2024
@jleach jleach requested a review from cvarjao October 24, 2024 20:36
end_ref="HEAD"
fi

change_count=$(git diff --name-only origin/main..${end_ref} | grep -E '^(app/.*)|(.yarn/.*)|(.github/workflows/.*)' | wc -l)
Copy link
Member

Choose a reason for hiding this comment

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

can you make origin/main dynamic? We can use ${GITHUB_BASE_REF:-HEAD} since GITHUB_BASE_REF is only provided for PRs, the :-HEAD will head the default to HEAD when not from a PR.

Copy link
Member Author

@jleach jleach Oct 24, 2024

Choose a reason for hiding this comment

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

Fixed, I had to include origin otherwise git complains if it being ambitious:

Run # On main branch, compare with the previous
Comparing main with HEAD
fatal: ambiguous argument 'main..HEAD': unknown revision or path not in the working tree.

I also tested origin/HEAD..HEAD^ works.

Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
@jleach jleach requested a review from cvarjao October 24, 2024 20:54
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Signed-off-by: Jason C. Leach <[email protected]>
Copy link

sonarcloud bot commented Oct 24, 2024

@jleach jleach merged commit 2a7c6f3 into main Oct 24, 2024
15 checks passed
@jleach jleach deleted the fix/debug-action branch October 24, 2024 22:53
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

Successfully merging this pull request may close these issues.

2 participants