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

Create a Pull Request on a separate repository. #667

Open
vinibosch opened this issue Mar 11, 2024 · 3 comments
Open

Create a Pull Request on a separate repository. #667

vinibosch opened this issue Mar 11, 2024 · 3 comments

Comments

@vinibosch
Copy link

Hello, do you have any plans to add support for creating Pull Requests on a different repository?

@gr2m
Copy link
Owner

gr2m commented Mar 11, 2024

You can do that already today, you just have to checkout the repository where you want to create the pull request. You can't do that with the provided secrets.GITHUB_TOKEN as it's scoped to only the current repository, I recommend to register a GitHub app with contents:write and pull_requests:write permissions and then use https://github.com/actions/create-github-app-token to create a token and use that token in actions/checkout

@lfgcampos
Copy link
Contributor

hi @gr2m, is there a way to checkout 2 repos but open a PR against a specific one only?

eg:

# default action stuff
...
    steps:
      - name: Checkout repo1
        uses: actions/checkout@v4
        with:
          path: repo1
      - name: Checkout repo2
        uses: actions/checkout@v4
        with:
          repository: org/repo2
          token: ${{ secrets.TOKEN_1 }}
          path: repo2

# change files based on repo1 to be commited on repo2
...

      - name: Commit file to repo2 repo
        uses: gr2m/create-or-update-pull-request-action@v1
        env:
          GITHUB_TOKEN: ${{ secrets.TOKEN_2 }}
        with:
          branch: "auto-repo2-update"
          commit-message: "repo2 auto-update"
          title: repo2 updates
          assignees: ${{ github.actor }}
          auto-merge: squash

I've tried with and without the path: repo2/ and it doesn't work.

The error is (with it):

Error: Command failed with exit code 128 (Unknown system error -128): git status repo2/

Without it:

Error: Command failed with exit code 128 (Unknown system error -128): git status

@gr2m
Copy link
Owner

gr2m commented Sep 26, 2024

I don't know, I'd have to look into it myself. I suggest you fork the repo and experiment to find out

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

3 participants