Merge pull request #896 from jfy133/automated-linkml-linting #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
name: LinkML Linting GitHub Action | |
on: | |
push: | |
paths: | |
- "src/mixs/schema/mixs.yaml" | |
jobs: | |
linkml: | |
permissions: | |
pull-requests: write | |
name: LinkML Linting | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
cache: 'poetry' | |
- name: Install Poetry | |
run: pipx install poetry | |
- name: Install dependencies | |
run: poetry install --no-interaction --no-root | |
- name: Run LinkML Linting | |
run: | | |
## Results file header and basic formatting | |
printf '# LinkML Linting Results \n\n' > linting-results.md | |
printf "$(linkml --version) linting found the following issues. \n\n" >> linting-results.md | |
printf "_For more information about the linting rule categories, see the [LinkML linter documentation](https://linkml.io/linkml/schemas/linter.html#rules)._\n" >> linting-results.md | |
## Lint the schema, and further format | |
poetry run linkml lint --config .linkml-lint-config.yml --ignore-warnings -f markdown src/mixs/schema/mixs.yaml >> linting-results.md | |
- name: Reformat log | |
run: | | |
sed -i -e 's/#### Errors/> [!CAUTION]/' -e 's/#### Warnings/> [!WARNING]/' -e 's/^*/> */' -e '/###.*yaml/ s/$/\n/' -e '/###.*yaml/ s/^###/**File**:/' linting-results.md | |
- name: Post PR comment | |
uses: mshick/add-pr-comment@v2 # v2 | |
with: | |
message-path: linting-results.md | |
repo-token: ${{ secrets.GITHUB_TOKEN }} | |
allow-repeats: true |