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

How to target base=master ? Issue with Command failed: git merge-base --fork-point #306

Open
gamegee opened this issue Oct 14, 2022 · 2 comments
Assignees

Comments

@gamegee
Copy link

gamegee commented Oct 14, 2022

Feature Request

My current flow for running the CI is the following :

  • Create a feature branch
  • Push the feature branch
  • Create a pull request with the base branch master

I am wondering how I can run affected running a comparison between the last commit of master --base=master and the last commit of the current branch.

Here is an example of my .github-action configuration:

  test:
    name: Test
    runs-on: ubuntu-latest
    needs: install-deps # other job installing the deps => npm i
    steps:
      - uses: actions/checkout@v2
        with:
          fetch-depth: 0
      - uses: actions/setup-node@v2
        with:
          node-version: "14"
      - name: Cache node modules
        id: cache
        uses: actions/cache@v2
        with:
          path: node_modules
          key: cache-node-modules-${{ hashFiles('package-lock.json') }}
      - uses: mansagroup/nrwl-nx-action@v2
        with:
          args: --verbose=false
          targets: test

Is your feature request related to a problem? Please describe.

When running the CI I have the following error :

nx "affected" "--target=test" "--base=bb2066fa076f1afc2cf0ced20096b56f2ad51c80" "--head=78f6e6aabdc9541d462fdba1ce770342068f2db2" "--verbose=false"

fatal: Not a valid commit name bb2066fa076f1afc2cf0ced20096b56f2ad51c80
fatal: No such ref: 'bb2066fa076f1afc2cf0ced20096b56f2ad51c80'

...

Error: Command failed: git merge-base --fork-point "bb2066fa076f1afc2cf0ced20096b56f2ad51c80" "78f6e6aabdc9541d462fdba1ce770342068f2db2"
fatal: No such ref: 'bb2066fa076f1afc2cf0ced20096b56f2ad51c80'

Describe the solution you'd like

I am not sure if I should be able to fix my issue, I want to be able to define my base being master.
Did I miss something or nrwl-nx-action should provide an API to resolve my issue ?

Teachability, Documentation, Adoption, Migration Strategy

@jeremylvln
Copy link
Member

Hi @gamegee, if you open a pull request the action should automatically infer the Git boundaries, taking the base as the branch your PR is opened against. So if your PR targets the master branch, this action will use the latest commit of the master branch as base.

Nx has progressed a lot since the last release of the action. Would you be able to test with the latest v3 release of the action just to confirm the issue is still present? Hopefully it will not!

@jeremylvln jeremylvln self-assigned this Oct 21, 2022
@abbudao
Copy link

abbudao commented Nov 4, 2022

Although I really love the simplicity of not having to specify any base on Pull requests, I would love to also use this action on my deployments using semver. As semver uses tags to mark where the last release happened in each environment, I can't make this action play nice with it. I believe #314 is just what I need to make my use case possible.

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

No branches or pull requests

3 participants