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

Failing with fatal on git reset. Ability to set target branch? #324

Open
thomasefbland opened this issue Sep 26, 2023 · 0 comments
Open

Comments

@thomasefbland
Copy link

Run changesets/action@v1
setting git user
/usr/bin/git config user.name "github-actions[bot]"
/usr/bin/git config user.email "github-actions[bot]@users.noreply.github.com"
setting GitHub credentials
/usr/bin/git checkout changeset-release/production
error: pathspec 'changeset-release/production' did not match any file(s) known to git
/usr/bin/git checkout -b changeset-release/production
Switched to a new branch 'changeset-release/production'
/usr/bin/git reset --hard 11a2675c561de6e166ad065d981b0ae3a6120e
fatal: Could not parse object '11a2675c561de6e166ad065d981b0ae3a6120e'.
Error: Error: The process '/usr/bin/git' failed with exit code 128
Error: The process '/usr/bin/git' failed with exit code 128

What I want to do is have the target branch for the PR merge always be the production branch.
This is the Action, it's pretty standard.

name: "CD: Preview"
on:
  workflow_run:
    workflows: ["CI"]
    types:
      - completed

concurrency: ${{ github.workflow }}-${{ github.ref }}

jobs:
  changeset:
    if: ${{ github.event.workflow_run.conclusion == 'success' }}
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v3
        with:
          ref: ${{ github.event.workflow_run.head_branch }}
      - uses: pnpm/action-setup@v2
        with:
          version: 8
      - uses: actions/setup-node@v3
        with:
          node-version: 18.x
          cache: "pnpm"

      - name: Install Dependencies
        run: pnpm install --frozen-lockfile

      - name: Create Pull Request
        id: changesets
        uses: changesets/action@v1
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

And the only difference in the Changesets config from the default is the baseBranch, since in the repo its named production not main

{
	"$schema": "https://unpkg.com/@changesets/config@2.3.1/schema.json",
	"changelog": "@changesets/cli/changelog",
	"commit": false,
	"fixed": [],
	"linked": [],
	"access": "restricted",
	"baseBranch": "production",
	"updateInternalDependencies": "patch",
	"ignore": []
}

Example would be some new branch feat/xyz gets a commit with a changeset. It passes CI, triggering the above Action. I want the merge request then to be created, targetting production.
Is there a good way to get the desired behavior? Or to resolve this crash?

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