generated from wrappid/wrappid-module
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(config): 🔧 add create and merge ci script
add script to merge dev branch into main branch with PR Ref: #30
- Loading branch information
1 parent
42c57ba
commit ea2360e
Showing
2 changed files
with
47 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: Auto Create and Merge PR | ||
|
||
on: | ||
workflow_dispatch: | ||
branches: | ||
- development | ||
env: | ||
GH_TOKEN: ${{ github.token }} | ||
jobs: | ||
create_and_merge_pr: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
issues: write | ||
pull-requests: write | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
ref: development | ||
|
||
- name: Check for changes | ||
id: check_changes | ||
run: | | ||
git fetch origin main:main | ||
changes=$(git diff --name-only main..development) | ||
if [ -z "$changes" ]; then | ||
echo "No changes detected. Exiting." | ||
exit 0 | ||
fi | ||
- name: Create PR | ||
run: | | ||
pr_url=$(gh pr create --base main --head development --title "Automated PR - Merge development branch into main Branch" --body "Automated PR created by GitHub Actions." | awk '/created/ {print $5}') | ||
echo "PR URL: $pr_url" | ||
- name: Merge PR | ||
run: | | ||
pr_number=$(echo $pr_url | cut -d '/' -f 7) | ||
- name: Merge PR | ||
run: | | ||
pr_number=$(echo $pr_url | cut -d '/' -f 7) | ||
gh pr merge $pr_number --auto --merge |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters