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

git checkout of PR branch causes mismatch of installed dependencies vs. code #835

Open
skagedal opened this issue Oct 18, 2024 · 0 comments

Comments

@skagedal
Copy link

We run lint-action essentially like the example in the README, with eslint and prettier. However, doing things this way seem to cause a mismatch between which commit dependencies are installed from and which commit the linting is run from, causing confusing build errors.

  1. First, the git repository is checked out using actions/checkout@v4. This, by default, does not check out the commit that the PR branch is pointing to, but the commit that would be result of the pull request branch getting merged into main. It does so by fetching the refs/remotes/pull/NNN/merge reference (see explanation here).
  2. Then, running from that merge commit, dependencies are installed.
  3. But then, the lint-action does its own fetching of the remote branch and checks out the unmerged pull request branch. This is where the lint checks are run.

This mismatch of dependencies and code can cause quite a bit of confusion when you don't realize what's happening. It seems that the reason that the PR branch is checked out is that lint-action needs this to be able to push to the branch. We do not, however, use this functionality.

Would it be possible to disable the checkout unless auto_fix is set to true?

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

No branches or pull requests

1 participant