|
1 |
| -name: Code format check |
2 |
| - |
3 |
| -on: |
| 1 | +############################# |
| 2 | +# Start the job on all push # |
| 3 | +############################# |
| 4 | +on: |
4 | 5 | push:
|
5 |
| - branches: |
6 |
| - - master |
| 6 | + branches-ignore: [edit] |
| 7 | + # Remove the line above to run when pushing to master |
| 8 | + pull_request: |
| 9 | + branches: [master] |
| 10 | + |
| 11 | +############### |
| 12 | +# Set the Job # |
| 13 | +############### |
7 | 14 | jobs:
|
8 |
| - dotnet-format: |
9 |
| - runs-on: windows-latest |
10 |
| - steps: |
| 15 | + build: |
| 16 | + # Name the Job |
| 17 | + name: Lint Code Base |
| 18 | + # Set the agent to run on |
| 19 | + runs-on: ubuntu-latest |
11 | 20 |
|
12 |
| - - name: Checkout repo |
13 |
| - uses: actions/checkout@v2 |
| 21 | + ################## |
| 22 | + # Load all steps # |
| 23 | + ################## |
| 24 | + steps: |
| 25 | + ########################## |
| 26 | + # Checkout the code base # |
| 27 | + ########################## |
| 28 | + - name: Checkout Code |
| 29 | + uses: actions/checkout@v3 |
14 | 30 | with:
|
15 |
| - ref: ${{ github.head_ref }} |
16 |
| - |
17 |
| - - name: Install dotnet-format |
18 |
| - run: dotnet tool install -g dotnet-format |
19 |
| - |
20 |
| - - name: Fix encoding |
21 |
| - run: EncodingNormalior -f . --TryFix true |
| 31 | + # Full git history is needed to get a proper |
| 32 | + # list of changed files within `super-linter` |
| 33 | + fetch-depth: 0 |
22 | 34 |
|
23 |
| - - name: Commit files |
24 |
| - run: | |
25 |
| - git config --local user.name "github-actions-dotnet-formatter[bot]" |
26 |
| - git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com" |
27 |
| - git commit -a -m 'Automated dotnet-format update' |
28 |
| - continue-on-error: true |
29 |
| - |
30 |
| - - name: Create Pull Request |
31 |
| - if: steps.format.outputs.has-changes == 'true' # 如果有格式化,才继续 |
32 |
| - uses: peter-evans/create-pull-request@v3 |
33 |
| - with: |
34 |
| - title: '[Bot] Automated PR to fix formatting errors' |
35 |
| - body: | |
36 |
| - Automated PR to fix formatting errors |
37 |
| - committer: GitHub <[email protected]> |
38 |
| - author: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> |
39 |
| - # 以下是给定代码审查者,需要设置仓库有权限的开发者 |
40 |
| - assignees: HsiangNianian |
41 |
| - reviewers: HsiangNianian |
42 |
| - # 对应的上传分支 |
43 |
| - branch: master |
| 35 | + ################################ |
| 36 | + # Run Linter against code base # |
| 37 | + ################################ |
| 38 | + - name: Lint Code Base |
| 39 | + uses: github/super-linter@v4 |
| 40 | + env: |
| 41 | + VALIDATE_ALL_CODEBASE: false |
| 42 | + # Change to 'master' if your main branch differs |
| 43 | + DEFAULT_BRANCH: master |
| 44 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments