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

feat: add force option to tryFetch #1189

Merged
merged 1 commit into from Jun 3, 2022

Conversation

leeopop
Copy link
Contributor

@leeopop leeopop commented May 25, 2022

The problem

Dockerized self-hosted runner (https://github.com/myoung34/docker-github-actions-runner) does not reset its local storage when a task is finished.

Thus, a newly created PR via worker#5 cannot be fetched via worker#7 because its not a fast-forward change.

This makes the later hasDiff logic that stops pushing if the actual content has no difference (the commit hashes are different because the commit has different createdAt timestamp.

[PR Log]
image

[Action Log]
image

[Actual diff between two consequent pushes]
image

Solution

Adding force option to git.fetch will overwrite previously cached branch information.

Justification

I found that all four git.fetch command in create-or-update-branch.ts already has the force option except the one changed in this PR.

Alternatives

I may add manual rm -rf /working/.git command before all self-hosted actions, but the above justification makes this solution more desirable.

@peter-evans
Copy link
Owner

peter-evans commented Jun 3, 2022

/test repository=leeopop/create-pull-request ref=feature/force-fetch build=true

Command run output

@peter-evans
Copy link
Owner

Hi @leeopop

Thank you for contributing.

I think adding --force to that fetch should be fine. I can't think of any potential issues.

@peter-evans peter-evans merged commit 923ad83 into peter-evans:main Jun 3, 2022
4 checks passed
@peter-evans
Copy link
Owner

Released as v4.0.4 / v4.

Thank you!

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.

None yet

2 participants