我想要确保我的Github中的任何拉请求都遵循.editorconfig (ASp.NET Core 5 C#项目)中定义的规则。我发现https://github.com/github/super-linter可以使用
我在工作流程中添加了下面的linter.yml文件,
---
###########################
###########################
## Linter GitHub Actions ##
###########################
###########################
name: Lint Code Base
#
# Documentation:
# https://help.github.com/en/articles/workflow-syntax-for-github-actions
#
#############################
# Start the job on all push #
#############################
on:
push:
branches-ignore: [main]
# Remove the line above to run when pushing to main
pull_request:
branches: [main]
###############
# Set the Job #
###############
jobs:
build:
# Name the Job
name: Lint Code Base
# Set the agent to run on
runs-on: ubuntu-latest
##################
# Load all steps #
##################
steps:
##########################
# Checkout the code base #
##########################
- name: Checkout Code
uses: actions/checkout@v2
with:
# Full git history is needed to get a proper list of changed files within `super-linter`
fetch-depth: 0
################################
# Run Linter against codebase #
################################
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}它是成功的,但我不认为它是在验证.editorconfig存储库根目录中的规则?我是不是遗漏了什么?
发布于 2021-06-06 19:45:52
检查超级Linter中的EDITORCONFIG_FILE_NAME,环境变量文件的默认值是.ecrc。
因此,如果文件名为.editorconfig,则必须将其添加到操作参数列表中,如下所示:
- name: Lint Code Base
uses: github/super-linter@v4
env:
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EDITORCONFIG_FILE_NAME: .editorconfig识别这个文件,超级链接操作将使用编辑配置检查器存储库来检查它。
编辑:基于注释的,超级链接器使用的dotnet-format也自动使用.editorconf文件。如果您想使用此链接检查它,则不需要设置EDITORCONFIG_FILE_NAME.只,设置VALIDATE_CSHARP: true
https://stackoverflow.com/questions/67863002
复制相似问题