Skip to content

Commit

Permalink
Merge pull request #3 from ditkrg/dev
Browse files Browse the repository at this point in the history
Aggregate staging releases
  • Loading branch information
5h4k4r authored Mar 6, 2024
2 parents fedb158 + 01e6ab0 commit ad88656
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,9 @@ runs:
shell: bash
env:
REPO: ${{ inputs.owner }}/${{ inputs.repo }}
# Define the label you want to check and create if it doesn't exist
LABEL_NAME: auto-deploy
# You can specify a color in hexadecimal format
LABEL_COLOR: 00FF00
# You can specify a color in hexadecimal format
LABEL_DESCRIPTION: "This label is used to automatically close a pr when the deployment is done"
# Set GH_TOKEN
GH_TOKEN: ${{ steps.generate-token.outputs.token }}

run: gh label create "$LABEL_NAME" --force --color "$LABEL_COLOR" --description "$LABEL_DESCRIPTION"
Expand All @@ -114,6 +110,8 @@ runs:
if [ $TARGET_ENV == "production" ]; then
BRANCH_NAME="prod-release"
elif [ $TARGET_ENV == "staging" ]; then
BRANCH_NAME="staging-release"
else
BRANCH_NAME=update-${{ steps.get-environment.outputs.environment }}-${{ inputs.component-name }}
fi
Expand Down Expand Up @@ -214,11 +212,16 @@ runs:
if [[ $(gh pr list --state open --base main --head $HEAD_BRANCH) ]]; then
echo "PR already exists"
else
if [ $TARGET_ENV == "production" ]; then
export pr_url=$(gh pr create --title "Production release" --body "Populating PR description with release notes :clock130: ..." --base main --head $HEAD_BRANCH)
elif [ $TARGET_ENV == "staging" ]; then
export pr_url=$(gh pr create --title "chore: Update ${{ inputs.component-name }} image tag in ${{ steps.get-environment.outputs.environment }}" --body "This PR was automatically created by the auto-deploy action" --base main --head $HEAD_BRANCH)
export pr_url=$(gh pr create --title "Staging release" --body "Populating PR description with release notes :clock130: ..." --base main --head $HEAD_BRANCH)
else
export pr_url=$(gh pr create --title "chore: Update ${{ inputs.component-name }} image tag in ${{ steps.get-environment.outputs.environment }}" --body "This PR was automatically created by the auto-deploy action" --base main --head $HEAD_BRANCH --label $LABEL_NAME)
fi
fi
Expand Down

0 comments on commit ad88656

Please sign in to comment.