Comments (3)
The reason this isn't working is not the message you see in the logs about detached HEAD, it's this line here:
Branch 'release/pingfederate-test-to-production' is not ahead of base 'main' and will not be created
Please follow this example:
https://github.com/peter-evans/create-pull-request/blob/main/docs/examples.md#keep-a-branch-up-to-date-with-another
My understanding is that you want to update main
from the specified tag. So your solution should look something like this:
jobs:
productionPromotion:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: main
- name: Reset main branch to match the specified tag
run: |
git fetch origin ${{ inputs.tag }}:${{ inputs.tag }}
git reset --hard ${{ inputs.tag }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
branch: "release/${{inputs.product}}-test-to-production"
I've never tried to use this method with a tag before, so it will be interesting to hear if it works ok.
from create-pull-request.
I tried updating the workflow like this. Attached the screen shot of the pull request and the extracted logs.
The below screen shot in create pull request steps shows only file is modified and will be added. But the created PR has the file which is copied in copy step in below. I need to ignore the file in test folder after copy step. The PR shouldn't have the test folder changes.
- name: Copy PingDirectory
if: inputs.product == 'pingdirectory'
run: |
rm -rf ./nuuday-ciam/production/pingdirectory
cp -r nuuday-ciam/test/pingdirectory/ nuuday-ciam/production/pingdirectory
find ./nuuday-ciam/production/pingdirectory/ -name '*_test.*' -type f -delete
- name: Copy PingFederate
if: inputs.product == 'pingfederate'
run: |
npm install --dev --prefix .build
rm -rf nuuday-ciam/production/pingfederate
cp -r nuuday-ciam/test/pingfederate nuuday-ciam/production/pingfederate
find ./nuuday-ciam/production/pingfederate/ -name '*.css.map*' -type f -delete
npm run config:production --prefix .build
![PR creation](https://private-user-images.githubusercontent.com/147699215/313225585-57a0f5a3-b959-4b06-8966-023f0c416128.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTc2NDQ2NTYsIm5iZiI6MTcxNzY0NDM1NiwicGF0aCI6Ii8xNDc2OTkyMTUvMzEzMjI1NTg1LTU3YTBmNWEzLWI5NTktNGIwNi04OTY2LTAyM2YwYzQxNjEyOC5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjQwNjA2JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI0MDYwNlQwMzI1NTZaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT0zMzM1YjQ0NGJiYTJjM2UxYWE1N2ZhOGE5N2EzNWJjZTkxMTZjNzRhYzZhODE3YWI1M2FkYjFkNWVjNTA5MjEzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCZhY3Rvcl9pZD0wJmtleV9pZD0wJnJlcG9faWQ9MCJ9.Gy95TisTiyHVeXvMcnjGjCQmzLbXVC5-b3YnFlzlDNc)
name: "Start Promotion Staging->Production"
permissions:
contents: write
issues: write
pull-requests: write
on:
workflow_call:
inputs:
product:
description: 'ping product to promote'
required: true
type: string
tag:
description: 'tag to deploy'
required: true
type: string
jobs:
promote:
runs-on: ubuntu-latest
name: Promoting from test to production
steps:
- uses: actions/checkout@v4
with:
ref: main
#- uses: actions/checkout@v4
# with:
# ref: ${{ inputs.tag }}
# fetch-depth: 0
- name: Reset main branch to match the specified tag
run: |
git fetch origin ${{ inputs.tag }}:${{ inputs.tag }}
git reset --hard ${{ inputs.tag }}
- name: Git status
run: git status
- name: Copy PingDirectory
if: inputs.product == 'pingdirectory'
run: |
rm -rf ./nuuday-ciam/production/pingdirectory
cp -r nuuday-ciam/test/pingdirectory/ nuuday-ciam/production/pingdirectory
find ./nuuday-ciam/production/pingdirectory/ -name '*_test.*' -type f -delete
- name: Copy PingFederate
if: inputs.product == 'pingfederate'
run: |
npm install --dev --prefix .build
rm -rf nuuday-ciam/production/pingfederate
cp -r nuuday-ciam/test/pingfederate nuuday-ciam/production/pingfederate
find ./nuuday-ciam/production/pingfederate/ -name '*.css.map*' -type f -delete
npm run config:production --prefix .build
- name: Git status
run: git status
#- name: Commit and push files to the tag
# run: |
# git config --local user.email "github-actions[bot]@users.noreply.github.com"
# git config --local user.name "github-actions[bot]"
# git add -A
# git commit -a -m "Add changes"
# git tag -d ${{ inputs.tag }}
# git tag ${{ inputs.tag }}
# git push origin :${{ inputs.tag }}
# git push origin ${{ inputs.tag }}
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.REPOSITORY_ROBOT_PAT }}
branch: "release/${{inputs.product}}-test-to-production"
commit-message: "chore(release): promoting ${{inputs.product}} from test to production"
title: "chore(release): promoting ${{inputs.product}} from test to production"
assignees: ${{ github.actor }}
base: main
labels: "automated promotion"
body: |
THIS IS AN AUTOMATED PROMOTION FROM THE TEST ENVIRONMENT TO PRODUCTION ENVIRONMENT.
PLEASE REVIEW THE FILE CHANGES IN THIS PR AND MERGE IT WHEN YOU ARE READY.
WHEN THIS PR IS MERGED, THE CHANGES WILL BE AUTOMATICALLY DEPLOYED TO PRODUCTION.
from create-pull-request.
add-paths doesn't seem to work as expected. It also add nuuday-ciam/test which doesn't match.
- name: Create Pull Request
uses: peter-evans/create-pull-request@v6
with:
token: ${{ secrets.REPOSITORY_ROBOT_PAT }}
branch: "release/${{inputs.product}}-test-to-production"
commit-message: "chore(release): promoting ${{inputs.product}} from test to production"
title: "chore(release): promoting ${{inputs.product}} from test to production"
assignees: ${{ github.actor }}
base: main
labels: "automated promotion"
add-paths: nuuday-ciam/production/
body: |
THIS IS AN AUTOMATED PROMOTION FROM THE TEST ENVIRONMENT TO PRODUCTION ENVIRONMENT.
PLEASE REVIEW THE FILE CHANGES IN THIS PR AND MERGE IT WHEN YOU ARE READY.
WHEN THIS PR IS MERGED, THE CHANGES WILL BE AUTOMATICALLY DEPLOYED TO PRODUCTION.
from create-pull-request.
Related Issues (20)
- bit
- I'm confused what the `base` option is supposed to do HOT 1
- Don't require a deep fetch for forks HOT 11
- Token generated from GitHub App not working with push-to-fork HOT 4
- Default to "Squash and Merge" HOT 1
- I get error "protected branch hook declined" when I try to create a draft pull request into protected branch HOT 1
- Force update the branch of existing pull request HOT 1
- Empty PRs being created, is this expected? HOT 4
- Error creating new PR HOT 2
- `title-path` and `commit-message-path` inputs HOT 1
- `base` also does a checkout to that branch HOT 1
- Update multiple repositories HOT 2
- ignore untracked HOT 2
- NO PR created and branch changes to new branch and updates from main HOT 5
- Required checks are not being triggered after the PR creation HOT 1
- Error: Input 'token' not supplied. Unable to continue. HOT 1
- Changes from test folder doesn't added to the PR HOT 10
- Node version - Warning HOT 1
- Permission denied (publickey) HOT 1
- Merge conflict error for different files with different names
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.