Skip to content

Avoid pulling if a new branch was just created #510

Open

Description

@thomaslima

Describe the bug
I am trying to use your action to push to a non-existent branch from a PR (not from a fork). I have used the following options:

      - uses: EndBug/add-and-commit@v9
        if: steps.verify-changed-files.outputs.files_changed == 'true'
        with:
          add: 'src'
          default_author: github_actions
          message: 'Auto-updated pyi stubs'
          new_branch: 'pyi'
          pull: '--rebase --autostash'

I get the following error: Error: There is no tracking information for the current branch. The reason is obvious. It is attempting to pull/rebase from a branch that doesn't exist. I might have missed some important documentation, but I figured the action wouldn't try to pull if the branch did not exist. The "solution" to this bug might just be a line in the documentation near the pull.

Workflow used

See actual workflow here: https://github.com/KLayout/klayout/blob/666f9b78de0c8b5dbff06126c5b70a699a1bbc61/.github/workflows/build.yml#L118

Expected behavior
Creating a branch if it doesn't exist. Rebasing to an existing branch if it does.

Logs
Failed action can be found here: https://github.com/KLayout/klayout/actions/runs/5115253333/jobs/9197185262
I am pasting the logs for convenience (and future reference).

Logs
2023-05-29T22:19:28.7415967Z ##[group]Run EndBug/add-and-commit@v9
2023-05-29T22:19:28.7416282Z with:
2023-05-29T22:19:28.7416523Z   add: src
2023-05-29T22:19:28.7416751Z   default_author: github_actions
2023-05-29T22:19:28.7417118Z   message: Auto-updated pyi stubs
2023-05-29T22:19:28.7417432Z   new_branch: pyi
2023-05-29T22:19:28.7417721Z   pull: --rebase --autostash
2023-05-29T22:19:28.7417961Z   cwd: .
2023-05-29T22:19:28.7418256Z   fetch: --tags --force
2023-05-29T22:19:28.7418569Z   pathspec_error_handling: ignore
2023-05-29T22:19:28.7418812Z   push: true
2023-05-29T22:19:28.7419222Z   github_token: ***
2023-05-29T22:19:28.7419500Z ##[endgroup]
2023-05-29T22:19:28.8721070Z Running in /home/runner/work/klayout/klayout
2023-05-29T22:19:28.8749881Z Add input parsed as single string, running 1 git add command.
2023-05-29T22:19:28.8750892Z > Using 'github-actions <41898282+github-actions[bot]@users.noreply.github.com>' as author.
2023-05-29T22:19:28.8751718Z > Using "Auto-updated pyi stubs" as commit message.
2023-05-29T22:19:28.8783155Z ##[group]Internal logs
2023-05-29T22:19:28.8786569Z > Staging files...
2023-05-29T22:19:28.8789248Z > Adding files...
2023-05-29T22:19:29.0089647Z > No files to remove.
2023-05-29T22:19:29.0090132Z > Checking for uncommitted changes in the git working tree...
2023-05-29T22:19:29.0629582Z > Found 4 changed files.
2023-05-29T22:19:29.4004450Z > Fetching repo...
2023-05-29T22:19:51.2641181Z {
2023-05-29T22:19:51.2642058Z   raw: '',
2023-05-29T22:19:51.2643005Z   remote: 'https://github.com/KLayout/klayout',
2023-05-29T22:19:51.2643413Z   branches: [
2023-05-29T22:19:51.2643871Z     { name: '0.26', tracking: 'origin/0.26' },
2023-05-29T22:19:51.2644364Z     { name: '0.27', tracking: 'origin/0.27' },
2023-05-29T22:19:51.2644758Z     {
2023-05-29T22:19:51.2645212Z       name: 'centos8_and_uitools',
2023-05-29T22:19:51.2645608Z       tracking: 'origin/centos8_and_uitools'
2023-05-29T22:19:51.2645913Z     },
2023-05-29T22:19:51.2646311Z     { name: 'cicd-0.27', tracking: 'origin/cicd-0.27' },
2023-05-29T22:19:51.2646785Z     { name: 'doc-fixes', tracking: 'origin/doc-fixes' },
2023-05-29T22:19:51.2647260Z     { name: 'doc-updates', tracking: 'origin/doc-updates' },
2023-05-29T22:19:51.2647595Z     {
2023-05-29T22:19:51.2647967Z       name: 'investigate-test-variations',
2023-05-29T22:19:51.2648429Z       tracking: 'origin/investigate-test-variations'
2023-05-29T22:19:51.2648765Z     },
2023-05-29T22:19:51.2649162Z     { name: 'issue-1346', tracking: 'origin/issue-1346' },
2023-05-29T22:19:51.2649623Z     { name: 'mac-m1-debug', tracking: 'origin/mac-m1-debug' },
2023-05-29T22:19:51.2649953Z     {
2023-05-29T22:19:51.2650310Z       name: 'marker-browser-improvements',
2023-05-29T22:19:51.2650776Z       tracking: 'origin/marker-browser-improvements'
2023-05-29T22:19:51.2651114Z     },
2023-05-29T22:19:51.2651482Z     { name: 'master', tracking: 'origin/master' },
2023-05-29T22:19:51.2651762Z     {
2023-05-29T22:19:51.2652116Z       name: 'msvc-building-with-debug',
2023-05-29T22:19:51.2652674Z       tracking: 'origin/msvc-building-with-debug'
2023-05-29T22:19:51.2653495Z     },
2023-05-29T22:19:51.2653908Z     { name: 'pypi_deploy', tracking: 'origin/pypi_deploy' },
2023-05-29T22:19:51.2654416Z     { name: 'sonarqube-fixes', tracking: 'origin/sonarqube-fixes' },
2023-05-29T22:19:51.2654889Z     { name: 'staging', tracking: 'origin/staging' },
2023-05-29T22:19:51.2655369Z     {
2023-05-29T22:19:51.2655720Z       name: 'thomaslima-patch-1',
2023-05-29T22:19:51.2656121Z       tracking: 'origin/thomaslima-patch-1'
2023-05-29T22:19:51.2656444Z     },
2023-05-29T22:19:51.2656776Z     { name: 'wip', tracking: 'origin/wip' },
2023-05-29T22:19:51.2657169Z     { name: 'wip2', tracking: 'origin/wip2' }
2023-05-29T22:19:51.2657472Z   ],
2023-05-29T22:19:51.2657729Z   tags: [
2023-05-29T22:19:51.2658092Z     { name: 'azure-test', tracking: 'azure-test' },
2023-05-29T22:19:51.2658569Z     { name: 'pymod/v0.26.0.dev15', tracking: 'pymod/v0.26.0.dev15' },
2023-05-29T22:19:51.2659210Z     { name: 'v0.25', tracking: 'v0.25' },
2023-05-29T22:19:51.2659637Z     { name: 'v0.25.1', tracking: 'v0.25.1' },
2023-05-29T22:19:51.2660029Z     { name: 'v0.25.2', tracking: 'v0.25.2' },
2023-05-29T22:19:51.2660415Z     { name: 'v0.25.3', tracking: 'v0.25.3' },
2023-05-29T22:19:51.2660799Z     { name: 'v0.25.4', tracking: 'v0.25.4' },
2023-05-29T22:19:51.2661182Z     { name: 'v0.25.5', tracking: 'v0.25.5' },
2023-05-29T22:19:51.2661550Z     { name: 'v0.25.6', tracking: 'v0.25.6' },
2023-05-29T22:19:51.2661947Z     { name: 'v0.25.7', tracking: 'v0.25.7' },
2023-05-29T22:19:51.2662307Z     { name: 'v0.25.8', tracking: 'v0.25.8' },
2023-05-29T22:19:51.2662676Z     { name: 'v0.25.9', tracking: 'v0.25.9' },
2023-05-29T22:19:51.2663049Z     { name: 'v0.26', tracking: 'v0.26' },
2023-05-29T22:19:51.2663431Z     { name: 'v0.26.1', tracking: 'v0.26.1' },
2023-05-29T22:19:51.2663817Z     { name: 'v0.26.10', tracking: 'v0.26.10' },
2023-05-29T22:19:51.2664217Z     { name: 'v0.26.11', tracking: 'v0.26.11' },
2023-05-29T22:19:51.2664600Z     { name: 'v0.26.12', tracking: 'v0.26.12' },
2023-05-29T22:19:51.2664997Z     { name: 'v0.26.2', tracking: 'v0.26.2' },
2023-05-29T22:19:51.2665378Z     { name: 'v0.26.3', tracking: 'v0.26.3' },
2023-05-29T22:19:51.2665758Z     { name: 'v0.26.4', tracking: 'v0.26.4' },
2023-05-29T22:19:51.2666140Z     { name: 'v0.26.5', tracking: 'v0.26.5' },
2023-05-29T22:19:51.2666518Z     { name: 'v0.26.6', tracking: 'v0.26.6' },
2023-05-29T22:19:51.2666900Z     { name: 'v0.26.7', tracking: 'v0.26.7' },
2023-05-29T22:19:51.2667292Z     { name: 'v0.26.7-1', tracking: 'v0.26.7-1' },
2023-05-29T22:19:51.2667672Z     { name: 'v0.26.8', tracking: 'v0.26.8' },
2023-05-29T22:19:51.2668036Z     { name: 'v0.26.9', tracking: 'v0.26.9' },
2023-05-29T22:19:51.2668416Z     { name: 'v0.26.9-1', tracking: 'v0.26.9-1' },
2023-05-29T22:19:51.2668819Z     { name: 'v0.26.9-2', tracking: 'v0.26.9-2' },
2023-05-29T22:19:51.2669206Z     { name: 'v0.27', tracking: 'v0.27' },
2023-05-29T22:19:51.2669581Z     { name: 'v0.27-1', tracking: 'v0.27-1' },
2023-05-29T22:19:51.2669973Z     { name: 'v0.27.1', tracking: 'v0.27.1' },
2023-05-29T22:19:51.2670363Z     { name: 'v0.27.10', tracking: 'v0.27.10' },
2023-05-29T22:19:51.2670755Z     { name: 'v0.27.11', tracking: 'v0.27.11' },
2023-05-29T22:19:51.2671143Z     { name: 'v0.27.12', tracking: 'v0.27.12' },
2023-05-29T22:19:51.2671528Z     { name: 'v0.27.13', tracking: 'v0.27.13' },
2023-05-29T22:19:51.2671912Z     { name: 'v0.27.2', tracking: 'v0.27.2' },
2023-05-29T22:19:51.2672300Z     { name: 'v0.27.3', tracking: 'v0.27.3' },
2023-05-29T22:19:51.2672680Z     { name: 'v0.27.4', tracking: 'v0.27.4' },
2023-05-29T22:19:51.2673072Z     { name: 'v0.27.4-1', tracking: 'v0.27.4-1' },
2023-05-29T22:19:51.2673451Z     { name: 'v0.27.5', tracking: 'v0.27.5' },
2023-05-29T22:19:51.2673832Z     { name: 'v0.27.6', tracking: 'v0.27.6' },
2023-05-29T22:19:51.2674195Z     { name: 'v0.27.7', tracking: 'v0.27.7' },
2023-05-29T22:19:51.2674576Z     { name: 'v0.27.7-1', tracking: 'v0.27.7-1' },
2023-05-29T22:19:51.2674975Z     { name: 'v0.27.8', tracking: 'v0.27.8' },
2023-05-29T22:19:51.2675516Z     { name: 'v0.27.9', tracking: 'v0.27.9' },
2023-05-29T22:19:51.2675909Z     { name: 'v0.27.9-1', tracking: 'v0.27.9-1' },
2023-05-29T22:19:51.2676290Z     { name: 'v0.28', tracking: 'v0.28' },
2023-05-29T22:19:51.2676677Z     { name: 'v0.28.1', tracking: 'v0.28.1' },
2023-05-29T22:19:51.2677056Z     { name: 'v0.28.2', tracking: 'v0.28.2' },
2023-05-29T22:19:51.2677340Z     {
2023-05-29T22:19:51.2677705Z       name: 'v0.28.2-azure-trigger-upload',
2023-05-29T22:19:51.2678136Z       tracking: 'v0.28.2-azure-trigger-upload'
2023-05-29T22:19:51.2678448Z     },
2023-05-29T22:19:51.2678780Z     { name: 'v0.28.3', tracking: 'v0.28.3' },
2023-05-29T22:19:51.2679161Z     { name: 'v0.28.4', tracking: 'v0.28.4' },
2023-05-29T22:19:51.2679544Z     { name: 'v0.28.5', tracking: 'v0.28.5' },
2023-05-29T22:19:51.2679921Z     { name: 'v0.28.6', tracking: 'v0.28.6' },
2023-05-29T22:19:51.2680301Z     { name: 'v0.28.7', tracking: 'v0.28.7' },
2023-05-29T22:19:51.2680801Z     { name: 'v0.28.8', tracking: 'v0.28.8' }
2023-05-29T22:19:51.2681115Z   ],
2023-05-29T22:19:51.2681364Z   updated: [],
2023-05-29T22:19:51.2681641Z   deleted: []
2023-05-29T22:19:51.2681901Z }
2023-05-29T22:19:51.2682294Z > Checking-out branch...
2023-05-29T22:19:51.2730759Z Creating 'pyi' branch.
2023-05-29T22:19:51.2762730Z > Pulling from remote...
2023-05-29T22:19:51.5070546Z {
2023-05-29T22:19:51.5071261Z   raw: '',
2023-05-29T22:19:51.5071600Z   remote: null,
2023-05-29T22:19:51.5071921Z   branches: [],
2023-05-29T22:19:51.5072233Z   tags: [],
2023-05-29T22:19:51.5072553Z   updated: [],
2023-05-29T22:19:51.5072853Z   deleted: []
2023-05-29T22:19:51.5073155Z }
2023-05-29T22:19:51.6907466Z ##[error]Error: There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
See git-pull(1) for details.
git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> pyi

2023-05-29T22:19:51.6915940Z ##[endgroup]
2023-05-29T22:19:51.6916944Z ##[group]Outputs
2023-05-29T22:19:51.6917147Z committed: false
2023-05-29T22:19:51.6917375Z commit_long_sha: undefined
2023-05-29T22:19:51.6917601Z commit_sha: undefined
2023-05-29T22:19:51.6917802Z pushed: false
2023-05-29T22:19:51.6918000Z tagged: false
2023-05-29T22:19:51.6918201Z tag_pushed: false
2023-05-29T22:19:51.6918548Z ##[endgroup]
2023-05-29T22:19:51.6920397Z ##[error]Error: There is no tracking information for the current branch.
Please specify which branch you want to rebase against.
See git-pull(1) for details.

git pull <remote> <branch>

If you wish to set tracking information for this branch you can do so with:

git branch --set-upstream-to=origin/<branch> pyi</code></pre>

Activity

  1. added
    status: pending
    on May 29, 2023
  2. changed the title [-]Pull from non-existent branch[/-] [+]Avoid pulling if a new branch was just created[/+] on May 31, 2023
  3. added
    status: pinned
    type: fix
    and removed
    status: pending
    on May 31, 2023
  4. EndBug commented on May 31, 2023

    @EndBug
    Owner

    It makes, sense: if a new branch was just created, it doesn't make sense to try to pull from the remote!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: pinnedtype: fix

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions