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

Initial review #14

Open
3 tasks done
minrk opened this issue Jul 7, 2021 · 3 comments
Open
3 tasks done

Initial review #14

minrk opened this issue Jul 7, 2021 · 3 comments

Comments

@minrk
Copy link
Contributor

minrk commented Jul 7, 2021

This is great!

Some notes from looking at the action:

I still don't know if it will work best to 'just' test the branch, or open local-branch PRs. WDYT so far after trying it out?

My initial thoughts:

  • pro PR: you get all the nice checks UI, easier view of success/failure
  • pro just branch: two PRs for the same change might get confusing. Which one do we merge? What happens when they update? If they are in-sync, merging either one should close both, but it's not easy to see if/when they are out of sync.
  • pro just branch: It seems like the checks/test conditions to avoid too many redundant tests might be easier for this case? I'm not sure.
@sgibson91
Copy link
Owner

sgibson91 commented Jul 7, 2021

Thank you for this! Great stuff to work on here.

Should the test-this-pr branch be deleted automatically on any particular event? E.g. merge/close of the parent PR?

This to me sounds like an optional feature so that the project maintainers can use their judgment. Although looking at the API docs, I can't easily find anything that'll close a PR, only merge one. So that might throw a spanner in the works this feature, and would be a point in favour for the "just branch" approach.

Edit: I think I meant this this other way around, but I'm also not sure I easily see an API endpoint to delete a branch either, but surely that's possible?

  • I believe there is already a merge ref available so you can avoid fetching both full repos and doing the merge yourself: git fetch origin pull/$NUMBER/merge:test-this-pr/$NUMBER will fetch the existing merge ref and create the local branch test-this-pr/$NUMBER.

This is good to know as at the minute, I'm stuck on git auth to clone the repo 😄 So this would solve the "needing the fork as a remote" problem. I know some actions require checkout of the repo before hand, so if we could do that and somehow pass the checkout to the Docker container, that'd be helpful. And I think the built-in GITHUB_TOKEN would have enough permissions to push.

Otherwise, I think we'd need to specifically create a PAT and store it as a repository secret, which feels like it circumvents the whole point of this action 😄

@minrk
Copy link
Contributor Author

minrk commented Jul 7, 2021

not sure I easily see an API endpoint to delete a branch

Weirdly it seems you have to use the git API to delete branches. So maybe if you have push access already, deleting via git push will be simplest: git push origin :test-this-pr/number

@sgibson91
Copy link
Owner

Should the test-this-pr branch be deleted automatically on any particular event?

On reflection I'm thinking if we do implement this, it wouldn't be in this repo built into this action. I think it's a whole other action that has probably already been implemented somewhere else.

For example in mybinder.org-deploy, we could have another job that looks something like the below.

jobs:
  ...
  delete-test-branch:
    # Only runs on pushes to test-this-pr/** branches
    if: (github.event_name == 'push') && (contains(github.ref, 'test-this-pr'))
    # Requires the deploy to staging job to succeed before this job runs
    needs: staging-deploy
    runs-on: ubuntu-latest
    steps:
      - run: |
          # Some code to delete the branch

Or there are some options that, e.g., sweep and delete merged and stale branches https://github.com/marketplace/actions/git-sweep-merged-and-stale

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

2 participants