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

Add to README how to checkout PR in issue_comment event #1248

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ADTC
Copy link

@ADTC ADTC commented Mar 26, 2023

Closes #331

@ADTC ADTC requested a review from a team as a code owner March 26, 2023 17:43
@zyv
Copy link

zyv commented May 30, 2023

I think the alternative with gh cli is worth mentioning, especially if afterwards one wants to do something with the branch.

@ADTC
Copy link
Author

ADTC commented May 30, 2023

@zyv is that the same as the latest comment in the issue? If not, please share your version here.

@zyv
Copy link

zyv commented Jun 9, 2023

@ADTC nope, I meant this option:

- uses: actions/checkout@v3

- run: hub pr checkout ${{ github.event.issue.number }}
  env:
    GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Your option is nice, but it's only useful if you want to check out the code e.g. for static checks or something. The downside though is that if you check out the code your way, you can't use the resulting checkout to push the changes back to the branch with git push afterwards.

That's why I suggest to mention both alternatives if not the more generic one, and explain the caveat of your "nicer" solution, to spare folks trying to push their changes back banging the head against the wall for too long.

@ADTC
Copy link
Author

ADTC commented Jun 9, 2023

@zyv what's the functional difference between your version and the one in this comment? Looks like they both do the same action, with yours being simpler code. Is that right?

Also, what's the difference between gh pr and hub pr?

@zyv
Copy link

zyv commented Jun 9, 2023

@zyv what's the functional difference between your version and the one in this comment? Looks like they both do the same action, with yours being simpler code. Is that right?

Correct.

Also, what's the difference between gh pr and hub pr?

gh is better:

https://github.com/cli/cli/blob/trunk/docs/gh-vs-hub.md

I guess you can just replace hub with gh in my code, but I haven't tested that.

@ADTC
Copy link
Author

ADTC commented Jun 10, 2023

I guess you can just replace hub with gh in my code, but I haven't tested that.

It will need to be tested. From what I gather, gh is not guaranteed to be backwards compatible with hub.

Also, are both hub and gh available by default in GitHub actions, or do you need to install them?

@zyv
Copy link

zyv commented Jun 10, 2023

Also, are both hub and gh available by default in GitHub actions, or do you need to install them?

Yes, see:

https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#preinstalled-software

Search for "GitHub CLI".

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

Successfully merging this pull request may close these issues.

Any way to checkout PR from issue_comment event?
3 participants