[Build] Add auto-format daily action (#11860)

* [Build] Add auto-format daily action

* Update dotnet-format-daily.yml
This commit is contained in:
Rui Marinho 2020-08-20 15:47:28 +01:00 коммит произвёл GitHub
Родитель a8bcaa9a60
Коммит 946a58ec81
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 60 добавлений и 0 удалений

60
.github/workflows/dotnet-format-daily.yml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,60 @@
name: Daily code format check
on:
schedule:
- cron: 0 0 * * * # Every day at midnight (UTC)
jobs:
dotnet-format:
runs-on: windows-latest
steps:
- name: Install dotnet-format
run: dotnet tool install -g dotnet-format
- name: Checkout repo
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Run dotnet format
id: format
uses: jfversluis/dotnet-format@v1.0.4
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
action: "fix"
#only-changed-files: true # only works for PRs
workspace: "Xamarin.Forms.sln"
- 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'
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: '[housekeeping] 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: housekeeping
assignees: rmarinho,samhouts
reviewers: rmarinho,samhouts
branch: housekeeping/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: ${{ secrets.GITHUB_TOKEN }}
# branch: ${{ github.event.pull_request.head.ref }}