-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci(actions): added github actions to automate pr creation
- Loading branch information
Showing
4 changed files
with
63 additions
and
0 deletions.
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,22 @@ | ||
name: create pull request to dev | ||
|
||
on: | ||
push: | ||
branches-ignore: | ||
- main | ||
- dev | ||
- master | ||
|
||
jobs: | ||
createDraftPR: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Execute bash script | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
chmod +x ./scripts/create-pr-to-dev | ||
./scripts/create-pr-to-dev |
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,20 @@ | ||
name: create pull request to main | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
|
||
jobs: | ||
createDraftPR: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Execute bash script | ||
env: | ||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: | | ||
chmod +x ./scripts/create-pr-to-main | ||
./scripts/create-pr-to-main |
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,11 @@ | ||
#!/usr/bin/env bash | ||
|
||
TICKET=$(git branch --show-current | sed 's/^\(.*\)--\(.*\)$/\1/' | tr '[:lower:]' '[:upper:]') | ||
DESC=$(git branch --show-current | sed 's/^.*--\(.*\)$/\1/;s/-/ /') | ||
|
||
if [[ $(gh pr list --json 'headRefName,baseRefName' | jq "[ .[] | select(.baseRefName == \"dev\" and .headRefName == \"$(git branch --show-current)\") ] | length") -gt 0 ]]; then | ||
echo "WARN: PR already exists, skipping." | ||
exit 0 | ||
fi | ||
|
||
gh pr create -B dev -H $(git branch --show-current) -t "$TICKET - $DESC" -b "$DESC" |
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,10 @@ | ||
#!/usr/bin/env bash | ||
|
||
TICKET=$(git branch --show-current | sed 's/^\(.*\)--\(.*\)$/\1/' | tr '[:lower:]' '[:upper:]') | ||
DESC=$(git branch --show-current | sed 's/^.*--\(.*\)$/\1/;s/-/ /') | ||
|
||
if [[ $(gh pr list --json 'headRefName,baseRefName' | jq "[ .[] | select(.headRefName == \"dev\" and .baseRefName == \"main\") ] | length") -gt 0 ]]; then | ||
exit 0 | ||
fi | ||
|
||
gh pr create -B main -H dev -t "Prod release" -b "This PR has been created automatically by a GitHub Action." |