-
-
Notifications
You must be signed in to change notification settings - Fork 136
60 lines (54 loc) · 2.25 KB
/
dotnet-format-daily.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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@v3
with:
ref: ${{ github.head_ref }}
- name: Run dotnet format
id: format
uses: jfversluis/dotnet-format@v1.0.5
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
action: "fix"
#only-changed-files: true # only works for PRs
workspace: "GitTrends.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: brminnick
reviewers: brminnick
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 }}