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

Change HEAD to original after execution instead of staying on INPUT_BASEREF #106

Closed

Conversation

ntsk
Copy link
Contributor

@ntsk ntsk commented Jan 23, 2024

Our team performs lint checks following this action and summarizes the findings in comments on GitHub. Currently, the branch remains on INPUT_BASEREF after execution, which is an implicit behavior.

For better clarity and workflow consistency, we propose reverting back to the original HEAD once the action completes. This change ensures subsequent tasks run on the appropriate context of the original commit.

@ntsk ntsk changed the title Change branch to original after execution instead of staying on INPUT_BASEREF Change HEAD to original after execution instead of staying on INPUT_BASEREF Jan 23, 2024
Copy link
Member

@mateuszkwiecinski mateuszkwiecinski left a comment

Choose a reason for hiding this comment

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

Thanks! I left one minor comment. I can address it on my own later this week, and release it together with #105

(Please ignore the CI failure, I still haven't managed to sort the token permission issue 👀)
Thanks again!

@@ -20,3 +22,5 @@ delimiter=$(openssl rand -hex 20)
echo "text-diff<<$delimiter" >> $GITHUB_OUTPUT
echo "$diff" >> $GITHUB_OUTPUT
echo "$delimiter" >> $GITHUB_OUTPUT

git checkout "$current_head"
Copy link
Member

Choose a reason for hiding this comment

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

🔧
We probably should use git switch here, right?

Suggested change
git checkout "$current_head"
git switch "$current_head"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With actions/checkout, it automatically moves to a detached HEAD state. To align with this behavior, I chose to use git checkout.
However, I agree that git switch --detach "$current_head" could also be a viable alternative.

mateuszkwiecinski added a commit that referenced this pull request Jan 26, 2024
…ution

Change HEAD to original after execution instead of staying on INPUT_BASEREF (Copy of #106)
@mateuszkwiecinski
Copy link
Member

Merged in #111, and included in https://github.com/usefulness/dependency-tree-diff-action/releases/tag/v2.0.0.
Thank you!

@ntsk ntsk deleted the revert-branch-back-after-execution branch January 27, 2024 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants