Create action.yml
parent
5eb0ff835f
commit
bd523a4ed8
@ -0,0 +1,66 @@
|
|||||||
|
name: "Code Formatting Setup"
|
||||||
|
description: ""
|
||||||
|
inputs:
|
||||||
|
workspace:
|
||||||
|
description: ''
|
||||||
|
default: ''
|
||||||
|
github-token:
|
||||||
|
description: ''
|
||||||
|
default: ''
|
||||||
|
|
||||||
|
runs:
|
||||||
|
using: "composite"
|
||||||
|
steps:
|
||||||
|
- name: Setup
|
||||||
|
uses: butr/actions-common-setup@v1.1
|
||||||
|
with:
|
||||||
|
github-token: ${{secrets.GITHUB_TOKEN}}
|
||||||
|
|
||||||
|
- name: Install dotnet-format
|
||||||
|
run: dotnet tool install -g dotnet-format
|
||||||
|
|
||||||
|
- name: Run dotnet format
|
||||||
|
id: format
|
||||||
|
uses: jfversluis/dotnet-format@v1.0.5
|
||||||
|
with:
|
||||||
|
repo-token: ${{ inputs.github-token }}
|
||||||
|
action: "fix"
|
||||||
|
#only-changed-files: true # only works for PRs
|
||||||
|
workspace: ${{ inputs.workspace }}
|
||||||
|
|
||||||
|
- name: Commit files
|
||||||
|
run: >-
|
||||||
|
if ('${{ steps.format.outputs.has-changes == 'true' }}' -eq '') { Return };
|
||||||
|
git config --local user.name "github-actions[bot]"
|
||||||
|
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
git commit -a -m 'Automated dotnet-format update'
|
||||||
|
shell: pwsh
|
||||||
|
|
||||||
|
- name: Create Pull Request
|
||||||
|
uses: peter-evans/create-pull-request@v3
|
||||||
|
with:
|
||||||
|
title: 'Automated PR to fix formatting errors'
|
||||||
|
body: |
|
||||||
|
Automated PR to fix formatting errors
|
||||||
|
committer: GitHub <noreply@github.com>
|
||||||
|
author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
|
||||||
|
labels: code-formatting
|
||||||
|
assignees: aragas, artifixer, zijistark
|
||||||
|
reviewers: aragas, artifixer, zijistark
|
||||||
|
branch: code-formatting/fix-codeformatting
|
||||||
|
|
||||||
|
# Pushing won't work to forked repos
|
||||||
|
# - name: Commit files
|
||||||
|
# if: steps.format.outputs.has-changes == 'true'
|
||||||
|
# run: |
|
||||||
|
# git config --local user.name "github-actions[bot]"
|
||||||
|
# git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
|
||||||
|
# git commit -a -m 'Automated dotnet-format update
|
||||||
|
# Co-authored-by: ${{ github.event.pull_request.user.login }} <${{ github.event.pull_request.user.id }}+${{ github.event.pull_request.user.login }}@users.noreply.github.com>'
|
||||||
|
|
||||||
|
# - name: Push changes
|
||||||
|
# if: steps.format.outputs.has-changes == 'true'
|
||||||
|
# uses: ad-m/github-push-action@v0.6.0
|
||||||
|
# with:
|
||||||
|
# github_token: ${{ inputs.github-token }}
|
||||||
|
# branch: ${{ github.event.pull_request.head.ref }}
|
Loading…
Reference in New Issue