pull-request
pull-request copied to clipboard
Add third-party repository support
This PR adds following features:
- Manual input for target repository (
destination_repository) - Automatic querying of the checked out repository (#55)
Sample usage:
jobs:
pull-request:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
repository: "octocat/hello-world"
- name: pull-request
uses: repo-sync/pull-request@v2
with:
destination_branch: "main"
github_token: ${{ secrets.GITHUB_TOKEN }}
In this example, the PR will be created in octocat/hello-world.
Notes:
🔵 Manual input has the highest priority. Final fallback is GITHUB_REPOSITORY env var
🔵 Supports both bare and non-bare repositories
🔵 Does not depend on actions/checkout
🟢 Minimal amount of modifications to the original source 🟢 Changes are fully backwards compatible 🟢 Functionality has been tested in numerous possible scenarios
Related issues: #18, #55
Hey I've just come across this today, it seems to be exactly what I need 🎉 is there any chance of getting it merged?
@mansona You can use my PR branch for the moment. I use this on pretty much all of my projects.
- name: pull-request
uses: m4heshd/pull-request@third-party-repos
with:
destination_branch: "main"
github_token: ${{ secrets.GITHUB_TOKEN }}
Or you can simply fork it and use.
Thanks for the bump. Will review and try to merge it soon.
@m4heshd yes I have been doing that to test this out 👍
one thing I will say as possible feedback, I had accidentally put the wrong name for the token for this action and it failed to create the PR, but it still showed as succeeding 🤔
https://github.com/mansona/test-copy-file-source/runs/5235589544?check_suite_focus=true#step:6:25
I don't know exactly how to do this but you might want to make sure that the exit code is correct in this scenario since I suspect that will be the most common error people will have (i.e. not having the right credentials set up)
@mansona Hmm.. 🤔. Gonna have to take a look at that. I already see what the issue is but need some free time on my hands to do some tests.
@m4heshd do you want to share the issue and maybe I can take a look? i.e. if you know what the problem is then maybe write a brief description here and if i have time I can take a look 👍
I'm trying to use the action in a private repo to no avail:
Given the following config:
name: Make PRs
on:
workflow_dispatch:
jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
# https://github.com/actions/checkout v3.1.0
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8
with:
repository: some/repo
token: ${{ secrets.TOKEN }}
- name: Mark github workspace as safe
run: git config --global --add safe.directory /github/workspace
- name: Create Pull Request
uses: m4heshd/pull-request@third-party-repos
with:
source_branch: main
destination_branch: dev
pr_title: 'Merge released code into dev branch'
pr_body: *An automated PR*
github_token: ${{ secrets.TOKEN }}
we're getting an error:
fatal: detected dubious ownership in repository at '/github/workspace'
To add an exception for this directory, call:
git config --global --add safe.directory /github/workspace
@mansona Sorry I missed your last response. I'm gonna take a look at it again.
@steven-prybylynskyi It's because of #84. Not related to this PR. But it should be fixed now since the changes are merged.
Meanwhile, can y'all try my fork (m4heshd/pull-request@third-party-repos) again and give me an update?
@ReenigneArcher I saw your issue in my mail and now you've deleted it. Can you confirm if everything's working correctly?
@ReenigneArcher I saw your issue in my mail and now you've deleted it. Can you confirm if everything's working correctly?
Sorry, my original issue was a dumb mistake on my part. I was accidentally using pr_template instead of pr_body, due to a copy and paste from another workflow of mine.
I do have one issue here though.
- name: Create Pull Request
# uses: repo-sync/pull-request@v2
# use this branch temporary to support creating PR against another repo
uses: m4heshd/pull-request@third-party-repos
with:
destination_repository: ${{ github.repository_owner }}/somerepo
source_branch: ${{ env.update_branch }}
destination_branch: nightly
pr_title: "Update"
pr_body: "Update with changes from ${{ github.repository }}"
pr_assignee: ${{ secrets.GH_BOT_NAME }}
pr_draft: false
pr_label: "dependencies, submodules"
pr_allow_empty: false
github_token: ${{ secrets.GH_BOT_TOKEN }}
PR labels are not being added to the PR that's created.
Here is the created PR: https://github.com/LizardByte/Sunshine/pull/603 And the logs from the workflow run with this action: https://github.com/LizardByte/build-deps/actions/runs/3754737056/jobs/6379211844#step:6:68
Note that the two labels I removed are added by another workflow... the two I specified here are not added at all.
@ReenigneArcher You can't have spaces between the labels list.
@wei Can we get this very useful PR merged? It's quite difficult to keep a 16-month-old PR up to date while resolving merge conflicts.
@allcontributors add @m4heshd for code
@wei Thank you for merging and Merry Christmas to you as well fellow dev. 🎄🎅🏽
It's now available at
repo-sync/pull-request@v2
repo-sync/[email protected]
docker://ghcr.io/repo-sync/pull-request:v2
docker://ghcr.io/repo-sync/pull-request:v2.10