Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions .github/actions/git/configure-identity/action.yml
Original file line number Diff line number Diff line change
@@ -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)"
6 changes: 4 additions & 2 deletions .github/actions/git/push-changes/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 8 additions & 5 deletions .github/actions/github/create-release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ runs:
echo "is-preview=${{ inputs.is-preview }}"
echo "preview-argument=${{ inputs.is-preview == 'true' && '--prerelease' || '' }}"
echo "notes-start-tag=${{ inputs.notes-start-tag }}"
echo "notes-start-tag-argument="${{ inputs.notes-start-tag != '' && '--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: 'Create git tag ${{ env.release-version }}'
- name: 'Configure git identity'
uses: './.github/actions/git/configure-identity'
- name: 'Create git tag ${{ inputs.release-version }}'
shell: bash
run: |
git tag -a ${{ env.release-version }} -m "${{ env.release-version }}"
- name: 'Create GitHub release PolylineAlgorithm ${{ env.release-version }}'
git tag -a ${{ inputs.release-version }} -m "${{ inputs.release-version }}"
git push origin ${{ inputs.release-version }}
- name: 'Create GitHub release PolylineAlgorithm ${{ inputs.release-version }}'
shell: bash
env:
GH_TOKEN: ${{ github.token }}
release-version: ${{ inputs.release-version }}
preview-argument: "${{ inputs.is-preview == 'true' && '--prerelease' || '' }}"
notes-start-tag-argument: "${{ inputs.notes-start-tag != '' && '--notes-start-tag $(inputs.notes-start-tag)' || '' }}"
notes-start-tag-argument: "${{ inputs.notes-start-tag != '' && format('--notes-start-tag {0}', inputs.notes-start-tag) || '' }}"
run: |
gh release create ${{ env.release-version }} --generate-notes --discussion-category "General" ${{ env.preview-argument }} ${{ env.notes-start-tag-argument }}
4 changes: 1 addition & 3 deletions .github/workflows/backtrack.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/bump-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
9 changes: 3 additions & 6 deletions .github/workflows/promote-branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ jobs:
target-branch-exists: ${{ steps.check-target-branch-exists.outputs.target-branch-exists }}
pull-request-exists: ${{ steps.check-pull-request-exists.outputs.pull-request-exists }}
steps:
- name: 'Checkout ${{ github.head_ref || github.ref }}'
uses: actions/checkout@v6
- name: 'Set target branch'
id: set-target-branch
run: |
Expand Down Expand Up @@ -211,17 +213,12 @@ jobs:
run: |
git fetch origin
git push origin origin/${{ env.base-branch }}:refs/heads/${{ env.target-branch }}
- name: 'Lock target branch'
if: ${{ needs.workflow-variables.outputs.target-branch-exists == 'false' }}
uses: './.github/actions/github/branch-protection/lock'
with:
branch: ${{ needs.workflow-variables.outputs.target-branch }}
token: ${{ secrets.GH_ADMIN_TOKEN }}
- name: 'Create PR: "Promote ${{ env.current-branch }} to ${{ env.target-branch }}"'
if: ${{ needs.workflow-variables.outputs.pull-request-exists == 'false' }}
env:
GH_TOKEN: ${{ github.token }}
current-branch: ${{ github.ref_name }}
target-branch: ${{ needs.workflow-variables.outputs.target-branch }}
run: |
git fetch origin ${{ env.target-branch }}
gh pr create --title "Promote ${{ env.current-branch }} to ${{ env.target-branch }}" --fill --base ${{ env.target-branch }} --head ${{ env.current-branch }}
3 changes: 2 additions & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ on:
- synchronize
- reopened
branches:
- 'develop/**'
- 'preview/**'
- 'release/**'
- 'release/**'

permissions:
actions: read
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ jobs:
needs: [workflow-variables, release, versioning]
if: ${{ needs.workflow-variables.outputs.is-release == 'true' }}
runs-on: ubuntu-latest
permissions:
pull-requests: write
contents: read
env:
GH_TOKEN: ${{ github.token }}
current-branch: ${{ github.ref_name }}
Expand Down Expand Up @@ -358,11 +361,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 }}"

Expand Down
Loading