-
-
Notifications
You must be signed in to change notification settings - Fork 434
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
Trying to create a pull request from another repo Github Action Workflows #3557
Comments
@iamnothere101 Please show me the complete workflow. What you've posted is not enough to figure out what is happening. Just some things I can see right off the bat:
|
Hi @peter-evans , I really appreciate the reply here. Yes, I modified the "branch" from head and I am using a PAT_Token. Here is the full workflow:
In the job, it's trying to create the PR in the source repo (where this workflow resides). It suppose to create a PR on destination repo not on the source repo itself. |
Please follow the documentation here. "Commit and push changes" Some other things:
|
Alright here you go: I updated to use the latest actions version, I am using the PAT_TOKEN and using a head-repo input.
The goal here is:
Its doing fine until step 5, However when I checked the logs, its trying to do a PR in the Source Repo, I even changed the head-repo to secondary repo and this step is still trying to do PR for the source repo instead of secondary repo. And one more weird thing I noticed here is, if the if and only step 6 fails, then only its updating my new branch with an updates SHA ( I am super confused here with this logic :-) ) |
- name: Checkout target repo
uses: actions/checkout@v4
with:
repository: MyOrg/secondary_repo
token: ${{ secrets.PAT_TOKEN }}
+ ref: main
- path: secondary_repo_folder_name
- - name: Commit and push changes
+ - name: Make changes
run: >
set -e
- cd secondary_repo_folder_name
- git config --global user.name 'GitHub User Name'
- git config --global user.email 'GitHub User Email'
- git checkout -b {{branch-name variable}}
cd path/of/kustomize/module || exit 1
kustomize edit set image xxxxxxxxxxxxxxxxxxxx${IMAGE_SHA}
- git add kustomization.yaml
- git commit -m "Update image to ****SHA"
- git push origin {{ new branch name }}
- name: Create Pull Request
- uses: peter-evans/create-pull-request@v4
+ uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.PAT_TOKEN }}
- repository: MyOrg/secondary_repo
- head-repo: MyOrg/primary_repo (source repo where this workflow resides)
- path: secondary_repo_folder_name
branch: {{branch-name variable}}
- base: main
title: Update image ****** $IMAGE_SHA
body: This PR updates the image SHA in the kustomization.yaml file to
$IMAGE_SHA. |
Truly appreciate it @peter-evans . Your fix worked like a charm. |
Subject of the issue
I have a CI setup where it will create an image and uploads it to the Docker Registry and checkout another GitHub repo and updates the kustomize file with the updated image tag. Then create a PR on the remote repo.
Steps to reproduce
Here is my workflow on the source repo:
However it seems its treating it as child repo:
I guess how can I create PR from the source repo's workflow on another GitHub repo?
Cheers! 🙋🏻♂️ 🫡
The text was updated successfully, but these errors were encountered: