diff --git a/.github/actions/git/configure-identity/action.yml b/.github/actions/git/configure-identity/action.yml new file mode 100644 index 00000000..ece38a74 --- /dev/null +++ b/.github/actions/git/configure-identity/action.yml @@ -0,0 +1,12 @@ +name: 'Configure git identity' +author: 'Pete Sramek' +description: 'Configures git user name and email from the last commit.' + +runs: + using: composite + steps: + - name: 'Configure git identity' + shell: bash + run: | + git config user.name "$(git log -n 1 --pretty=format:%an)" + git config user.email "$(git log -n 1 --pretty=format:%ae)" diff --git a/.github/actions/git/push-changes/action.yml b/.github/actions/git/push-changes/action.yml index 31ddd3f2..5c728462 100644 --- a/.github/actions/git/push-changes/action.yml +++ b/.github/actions/git/push-changes/action.yml @@ -87,12 +87,14 @@ runs: set -e working-directory: ${{ inputs.working-directory }} + - name: Configure git identity + if: ${{ fromJSON(steps.validate.outputs.has-changes) == '1' }} + uses: './.github/actions/git/configure-identity' + - name: Push changes to ${{ github.head_ref || github.ref }} if: ${{ fromJSON(steps.validate.outputs.has-changes) == '1' }} shell: bash run: | - git config user.name "$(git log -n 1 --pretty=format:%an)" - git config user.email "$(git log -n 1 --pretty=format:%ae)" git commit -m '${{ inputs.commit-message }}' git pull --rebase origin ${{ github.head_ref || github.ref }} git push diff --git a/.github/actions/github/create-release/action.yml b/.github/actions/github/create-release/action.yml index cc93fc7f..3ded70f2 100644 --- a/.github/actions/github/create-release/action.yml +++ b/.github/actions/github/create-release/action.yml @@ -25,6 +25,8 @@ runs: echo "notes-start-tag=${{ inputs.notes-start-tag }}" echo "notes-start-tag-argument=${{ inputs.notes-start-tag != '' && format('--notes-start-tag {0}', inputs.notes-start-tag) || '' }}" shell: bash + - name: 'Configure git identity' + uses: './.github/actions/git/configure-identity' - name: 'Create git tag ${{ inputs.release-version }}' shell: bash run: | diff --git a/.github/workflows/backtrack.yml b/.github/workflows/backtrack.yml index 82f5483b..9149061f 100644 --- a/.github/workflows/backtrack.yml +++ b/.github/workflows/backtrack.yml @@ -30,9 +30,7 @@ jobs: token: ${{ secrets.GH_ADMIN_TOKEN }} - name: 'Configure git' - run: | - git config user.name "$(git log -n 1 --pretty=format:%an)" - git config user.email "$(git log -n 1 --pretty=format:%ae)" + uses: './.github/actions/git/configure-identity' - name: 'Resolve backtrack targets' id: targets diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index 6f79680c..2abd97ba 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -113,9 +113,7 @@ jobs: dotnet-version: ${{ env.dotnet-sdk-version }} - name: 'Configure git' - run: | - git config user.name "$(git log -n 1 --pretty=format:%an)" - git config user.email "$(git log -n 1 --pretty=format:%ae)" + uses: './.github/actions/git/configure-identity' - name: 'Create develop branch from main' run: | diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 29392ddf..4f8917b0 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -8,8 +8,9 @@ on: - synchronize - reopened branches: + - 'develop/**' - 'preview/**' - - 'release/**' + - 'release/**' permissions: actions: read diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f8997287..c9df3e77 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -358,11 +358,13 @@ jobs: echo "support-branch-exists=false" >> $GITHUB_OUTPUT fi + - name: 'Configure git identity' + if: ${{ steps.check-support-branch.outputs.support-branch-exists == 'false' }} + uses: './.github/actions/git/configure-identity' + - name: 'Create support branch' if: ${{ steps.check-support-branch.outputs.support-branch-exists == 'false' }} run: | - git config user.name "$(git log -n 1 --pretty=format:%an)" - git config user.email "$(git log -n 1 --pretty=format:%ae)" git checkout -b "${{ steps.resolve-support-branch.outputs.support-branch }}" git push --set-upstream origin "${{ steps.resolve-support-branch.outputs.support-branch }}"