Skip to content

Work out PR number for head branch #119

Closed

Description

@gibfahn

It'd be nice if I could do get-metadata (or get-metadata @) if I'm on a fork branch with an open PR.

Could do something like:

# Get the remote url of the upstream branch (if it exists).
remote=$(git remote get-url $(git rev-parse --abbrev-ref --symbolic-full-name @{u} | cut -d / -f 1))
branch=$(git symbolic-ref --short HEAD) # Or branch parameter passed.

# Convert to https:// syntax if it's ssh syntax (git@github.com)

# Work out what PR has that as a base branch

# Pass PR number through to the rest of get-metadata.

Activity

  1. joyeecheung commented on Nov 21, 2017

    @joyeecheung
    Member

    #106 kinda needs this as well, although that one is for landing PRs that are not necessarily opened by the people landing them. I am thinking a git node config command to associate remote/branch settings so the configuration persists and we don't have to pass the parameter all the time. The prototype in https://asciinema.org/a/6i3gFDSAr7L6fYPSEaMrW0asO uses manually edited fields in ~/.ncurc at the moment but it would attempt to override settings from <project_dir>/.ncu/config

  2. joyeecheung commented on Nov 21, 2017

    @joyeecheung
    Member

    Also it would be convenient if I can git node pr --open from the current branch, which open the PR and associate the branches for you, a bit like git cl upload of chromium/v8. That doesn't seem very difficult once #106 works out.

  3. gibfahn commented on Nov 21, 2017

    @gibfahn
    MemberAuthor

    I am thinking a git node config command to associate remote/branch settings so the configuration persists and we don't have to pass the parameter all the time.

    Config option makes sense, although I think working it out from the remote branch that the local one is tracking is a good fallback.

    git node pr --open from the current branch, which open the PR and associate the branches for you, a bit like git cl upload of chromium/v8.

    What do you mean by associating the branches for you? I can see that you could automate the "raise PR from fork/mybranch against upstream/master with this comment".

  4. joyeecheung commented on Nov 21, 2017

    @joyeecheung
    Member

    @gibfahn It means the .ncu folder somehow stores the relationship between pr ids and it's remote branch + base branch, no matter the relationship comes from

    1. Worked out as OP suggests (using Github API?) Maybe git node pr --guess && get-metadata, and let get-metadata grab the PR after looking into .ncu if no PR ID is supplied
    2. git node pr --set <prid> <branch> [base branch] (just some imaginary commands)
    3. git node pr --open [base branch] (opens the PR for you so it will know the PR ID and save it to .ncu)
  5. joyeecheung commented on Nov 21, 2017

    @joyeecheung
    Member

    Aside: it would be great if git node pr --open also kicks of the CI automatically (after receiving a yes from the prompt)

  6. evanlucas commented on Nov 21, 2017

    @evanlucas

    @joyeecheung I had previously worked on something to kick off a CI run at https://github.com/evanlucas/nodejs-ci-ctl

  7. joyeecheung commented on Nov 22, 2017

    @joyeecheung
    Member

    @evanlucas Awesome, I will see if I can integrate that into the git commands

  8. self-assigned this
    on Nov 23, 2017
  9. github-actions commented on Aug 18, 2020

    @github-actions
    Contributor

    This issue is stale because it has been open many days with no activity. It will be closed soon unless the stale label is removed or a comment is made.

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions