Skip to content

Merge pull request #80 from WeihanLi/dev #232

Merge pull request #80 from WeihanLi/dev

Merge pull request #80 from WeihanLi/dev #232

Workflow file for this run

name: dotnet-format
on:
push:
branches:
- "main"
- "dev"
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup .NET SDK
uses: actions/setup-dotnet@v3
with:
dotnet-version: |
6.0.x
7.0.x
8.0.x
include-prerelease: true
- name: dotnet info
run: dotnet --info
- name: build
run: dotnet build
- name: format
run: dotnet format
- name: check for changes
run: |
if git diff --exit-code; then
echo "has_changes=false" >> $GITHUB_ENV
else
echo "has_changes=true" >> $GITHUB_ENV
fi
- name: Commit and Push
if: ${{ env.has_changes == 'true' }}
shell: bash
run: |
# echo $GITHUB_REF_NAME
# echo $GITHUB_SHA
git config --local user.name "github-actions[bot]"
git config --local user.email "[email protected]"
git add -u
git commit -m "Automated dotnet-format update from commit ${GITHUB_SHA} on ${GITHUB_REF}"
git log -1
remote_repo="https://${GITHUB_ACTOR}:${{secrets.GITHUB_TOKEN}}@github.com/${GITHUB_REPOSITORY}.git"
git push "${remote_repo}" HEAD:${GITHUB_REF}