lint-action
lint-action copied to clipboard
Command failed: git branch --force development --track origin/development
Hello!
First of all, thanks for making this.
A few days ago, I had everything set up fine and my GitHub Action was succesfully linting pull requests on master using Prettier, ESLint and Stylelint. However, in the mean time I did something that makes this lint action fail on every run:
Command failed: git branch --force development --track origin/development
error: the requested upstream branch 'origin/development' does not exist
hint:
hint: If you are planning on basing your work on an upstream
hint: branch that already exists at the remote, you may need to
hint: run "git fetch" to retrieve it.
hint:
hint: If you are planning to push out a new local branch that
hint: will track its remote counterpart, you may want to use
hint: "git push -u" to set the upstream config as you push.
The steps I took that I think might have caused this problem:
- Delete
origin/development
(I know, bad idea — I wanted to remove a certain commit) - Reset the local branch to a previous commit and discard the local changes
- Push development to the remote
After some further testing, it seems that I cannot reuse the name development
for any newly created branch (and then run a PR against master).
I think this is related to https://github.com/wearerequired/lint-action/issues/13#issuecomment-708611002. I am looking for a fix
I'm wondering if the whole checkOutRemoteBranch()
function/process is still required and if we can't instead rely on the actions/checkout@v2
action.
There's a comment about why this function exists in https://github.com/wearerequired/lint-action/blob/b98b0918aa71490373d2eca9e8e39a9bc1cc2517/src/index.js#L42-L50
And I think this has been fixed in v2 of the checkout action, see the release notes.
Oh interesting! It seems like it could be removed then! I will try running the tests with it removed and see if it works
Is there any update on this. We are unable to run our lint jobs for pull requests because of this issue. We don't autofix, anyway, so there is really no reason for us to do a checkout.
hello, any updates on this? i'm trying to do what was suggested in #498 for a monorepo, but the action fails on the second call within a same workflow with a similar error:
fatal: cannot force update the branch 'chore/eslint-rules' checked out at '/home/runner/work/my-repo/my-repo'
Error: Command failed: git branch --force chore/eslint-rules --track origin/chore/eslint-rules
the workflow is set up like so:
# setup omitted
jobs:
test:
runs-on: ubuntu-latest
steps:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: '16.x'
cache: 'yarn'
- name: Test monorepo
run: yarn test
- name: Run lint action on SDK
uses: wearerequired/lint-action@v2
with:
check_name: 'ESLint/SDK'
auto_fix: false
commit: false
eslint: true
eslint_dir: packages/sdk
eslint_extensions: js,ts
- name: Run lint action on React library
uses: wearerequired/lint-action@v2
with:
check_name: 'ESLint/React'
auto_fix: false
commit: false
eslint: true
eslint_dir: packages/react
eslint_extensions: js,ts,tsx
# rest of workflow file omitted
Any update on this? We're having the same issue as @jaxonL and the only solution we found was to create two separate jobs.