Skip to content

Commit

Permalink
feat: Add version input and use in commit message
Browse files Browse the repository at this point in the history
Use version instead of git sha in commit message and title if provided
  • Loading branch information
pravindahal committed Sep 17, 2024
1 parent adb9b52 commit c838ae3
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions .github/workflows/update-infrastructure-repo.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ on:
required: false
type: string
default: "service"
version:
required: false
type: string
description: Version to use in commit message and PR title. If not provided, git sha is used.
close-existing-prs:
required: false
type: boolean
Expand Down Expand Up @@ -86,15 +90,25 @@ jobs:
echo "BRANCH=update-${{ matrix.environment }}-to-${{ github.sha }}" >> $GITHUB_OUTPUT
fi
- name: Set commit message
id: set-commit-message
run: |
if [ "${{ inputs.version }}" != "" ]
then
echo "COMMIT_MESSAGE=Bump \`${{ inputs.service }}\` to version \`${{ inputs.version }}\` in \'${{ matrix.environment }}\'" >> $GITHUB_OUTPUT
else
echo "COMMIT_MESSAGE=Bump \`${{ inputs.service }}\` to \`${{ github.sha }}\` in \'${{ matrix.environment }}\'" >> $GITHUB_OUTPUT
fi
- name: Create Pull Request
id: cpr
# v3.14.0
uses: peter-evans/create-pull-request@6cd32fd93684475c31847837f87bb135d40a2b79
with:
path: ${{ inputs.working-directory }}
token: ${{ steps.generate_token.outputs.token }}
commit-message: Bump ${{ inputs.service }} to ${{ github.sha }} in ${{ matrix.environment }}
title: Bump ${{ inputs.service }} to ${{ github.sha }} in ${{ matrix.environment }}
commit-message: ${{ steps.set-commit-message.outputs.COMMIT_MESSAGE }}
title: ${{ steps.set-commit-message.outputs.COMMIT_MESSAGE }}
committer: GitHub <[email protected]>
author: GitHub <[email protected]>
branch: ${{ steps.set-branch-name.outputs.BRANCH }}
Expand Down

0 comments on commit c838ae3

Please sign in to comment.