hub4j / github-api

Java API for GitHub
https://github-api.kohsuke.org/
MIT License
1.12k stars 718 forks source link

"Create New Release Tag" action fails due to `staging/main` not merging from `main` before making changes #1820

Closed bitwiseman closed 4 months ago

bitwiseman commented 4 months ago

The "Create New Release Tag" checks out main, them makes changes, then tries to push to staging/main.

This error then occurs:

Started: bash /home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v5/entrypoint.sh
INPUT_REPOSITORY value: .
INPUT_STATUS_OPTIONS: 
INPUT_FILE_PATTERN: .
INPUT_BRANCH value: staging/main
From https://github.com/hub4j/github-api
 * [new branch]      bitwiseman-patch-1     -> origin/bitwiseman-patch-1
 * [new branch]      dependabot/maven/org.apache.commons-commons-lang3-3.14.0 -> origin/dependabot/maven/org.apache.commons-commons-lang3-3.14.0
 * [new branch]      dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.9.0 -> origin/dependabot/maven/org.apache.maven.plugins-maven-compiler-plugin-3.9.0
 * [new branch]      dependabot/maven/org.mockito-mockito-core-5.5.0 -> origin/dependabot/maven/org.mockito-mockito-core-5.5.0
 * [new branch]      dependabot/maven/spotbugs.version-4.8.2 -> origin/dependabot/maven/spotbugs.version-4.8.2
 * [new branch]      feature/2.x            -> origin/feature/2.x
 * [new branch]      feature/new-maven-central-publishing -> origin/feature/new-maven-central-publishing
 * [new branch]      gh-pages               -> origin/gh-pages
 * [new branch]      issue/packages         -> origin/issue/packages
 * [new branch]      main-2.x               -> origin/main-2.x
 * [new branch]      release/v1.x           -> origin/release/v1.x
 * [new branch]      release/v1.x-unbridged -> origin/release/v1.x-unbridged
 * [new branch]      revert-spotbugs-4.2.2  -> origin/revert-spotbugs-4.2.2
 * [new branch]      staging/main           -> origin/staging/main
error: Your local changes to the following files would be overwritten by checkout:
    pom.xml
Please commit your changes or stash them before you switch branches.
Aborting
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v5/index.js:17:19)
    at ChildProcess.emit (node:events:514:[28](https://github.com/hub4j/github-api/actions/runs/8332989629/job/22803417053#step:6:29))
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:[30](https://github.com/hub4j/github-api/actions/runs/8332989629/job/22803417053#step:6:31)5:5) {
  code: 1
}
Error: Invalid status code: 1
    at ChildProcess.<anonymous> (/home/runner/work/_actions/stefanzweifel/git-auto-commit-action/v5/index.js:17:19)
    at ChildProcess.emit (node:events:[51](https://github.com/hub4j/github-api/actions/runs/8332989629/job/22803417053#step:6:52)4:28)
    at maybeClose (node:internal/child_process:1105:16)
    at ChildProcess._handle.onexit (node:internal/child_process:305:5)

The action should checkout staging/main, then merge from main. After that it will complete correctly.

bitwiseman commented 4 months ago

Fixed: https://github.com/hub4j/github-api/commit/f7440e3a8f0c4e0a575b2f4e62b9fc323da925db and the previous commit.