Comments (5)
Hi @jderusse
Interesting use case! Try the following workflow. I've not had chance to test it yet, but I think it might work. You will need to create a repo
scoped Personal Access Token (PAT) so that the main repo can create a pull request in the remote repository.
Do you need the Task
step? I'm assuming you just want to update the fork's master
branch from the master
branch of the main repo.
- name: Set up SSH
uses: webfactory/[email protected]
with:
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
- uses: actions/checkout@v2
with:
ref: master
- name: Set remote URL
run: |
git remote set-url origin [email protected]:fork/fork.git .
- name: Create Pull Request
uses: peter-evans/create-pull-request@v2
with:
token: ${{ secrets.PAT }}
branch: bot-code-update
from create-pull-request.
hello @peter-evans, thanks for the fast reply
I think there is a missunderstood. The PR should not be created on the fork repo, but in the main repo. The fork is used for the "head" of the PR.
In fact I try to use the exact same workflow when creating a standard PR by human
- go to project's main repo
- fork
- push commit on the fork
- create a PR on the main repo
I can "push commit on the fork" change thanks SSH private key (FYI, we don't use "deploy key", but crated a bot-user, the fork belongs to the bot)
Issue is: how to tell peter-evans/create-pull-request
that base and head don't have the same repo
I followed your snippet (https://github.com/async-aws/aws/pull/375/files) but the Action seem to generate a PR in the fork (https://github.com/async-aws/aws/runs/539592083?check_suite_focus=true). see PR #1
in Created pull request #1 (bot-code-update => master)
Thanks for your help
from create-pull-request.
I think the "issue" (or enhancement) is here
create-pull-request/src/cpr/create_or_update_pull_request.py
Lines 63 to 65 in ac9f92d
We should be able to provide the head repositorylike described in "https://developer.github.com/v3/pulls/#input"
if head_repository is None:
head_repository = github_repository.split("/")[0]
head_branch = "{}:{}".format(head_repository, branch)
try:
pull_request = github_repo.create_pull(
title=title, body=body, base=base, head=head_branch
)
print(f"Created pull request #{pull_request.number} ({branch} => {base})")
except GithubException as e:
if e.status == 422:
# A pull request exists for this branch and base
# Get the pull request
pull_request = github_repo.get_pulls(
state="open", base=base, head=head_branch
)[0]
# Update title and body
pull_request.as_issue().edit(title=title, body=body)
print(f"Updated pull request #{pull_request.number} ({branch} => {base})")
else:
print(str(e))
raise
where head_repository is a new optionnal parameter provided by user
from create-pull-request.
Thanks for explaining further. I understand what you want to do now. Essentially, you want to push the branch to a fork and pull request to the current repository using the branch in the fork. I see how this makes sense if you use SSH because the key can just have permission for the fork not the main repo. 👍
Thanks for having a shot at implementing this. I'll take a look at your PR and make some comments.
from create-pull-request.
Thank you again for contributing this feature!
I've released it as v2.5.0
or follow the major version v2
.
from create-pull-request.
Related Issues (20)
- Is it possible to fully restore all git state after the action? HOT 5
- Deep fetch results in massive download HOT 2
- Question about Repository HOT 1
- Provide a 'commit-message-body' field? HOT 3
- Failing to create PR using example HOT 1
- Base branch being commited with changes from branch HOT 1
- Failing to create PR HOT 1
- Action does not seem to produce outputs when adding sleep step in between
- Telegram HOT 2
- Support for gitea pull request ? HOT 2
- Add permissions to example in README HOT 2
- PR Creation does not take place despite the step running with success HOT 5
- Unable to use pr number output HOT 1
- PR creation failing due to fetch failing HOT 43
- Add color to labels HOT 1
- push only with --force-with-lease HOT 2
- Breaking change with v6: Error: GitHub Actions is not permitted to create or approve pull requests. HOT 2
- Support converting PR back to draft HOT 1
- Change the authorship of pull requests HOT 1
- Cannot read properties of undefined (reading 'number') HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from create-pull-request.