Skip to content

Commit c26f25a

Browse files
committed
Cleaned up and improved
1 parent 52aea36 commit c26f25a

File tree

95 files changed

+597
-138
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

95 files changed

+597
-138
lines changed

.github/workflows/documentation.yaml

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ on: pull_request
33
name: Review
44

55
env:
6-
COMPOSE_USER: root
6+
COMPOSE_USER: runner
77

88
jobs:
99
check-github-actions-documentation:
@@ -12,20 +12,34 @@ jobs:
1212
steps:
1313
- uses: actions/checkout@v4
1414
- uses: arduino/setup-task@v2
15+
# https://github.com/arduino/setup-task/tree/56d0cc033e3cecc5f07a291fdd39f29388d21800?tab=readme-ov-file#repo-token
16+
with:
17+
repo-token: ${{ secrets.GITHUB_TOKEN }}
18+
19+
# https://github.com/mxschmitt/action-tmate?tab=readme-ov-file#manually-triggered-debug
20+
# Enable tmate debugging if debug logging is enabled (cf.
21+
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/accessing-contextual-information-about-workflow-runs#runner-context)
22+
- name: Setup tmate session
23+
uses: mxschmitt/action-tmate@v3
24+
if: 1 == runner.debug
25+
1526
- run: |
1627
task github-actions:documentation:update
28+
1729
# Check that documentation has not changed.
1830
- run: |
19-
git diff --exit-code docs/github-action-templates.md
31+
task github-actions:documentation:diff
2032
2133
check-github-actions-template-headers:
2234
runs-on: ubuntu-latest
2335
name: Check that Github Actions template headers are up to date
2436
steps:
2537
- uses: actions/checkout@v4
2638
- uses: arduino/setup-task@v2
39+
with:
40+
repo-token: ${{ secrets.GITHUB_TOKEN }}
2741
- run: |
28-
task github-actions:update-headers --yes
42+
task github-actions:template-headers:update --yes
2943
# Check that files hav not changed.
3044
- run: |
3145
git diff --exit-code github/workflows/

.markdownlint.jsonc

Lines changed: 0 additions & 1 deletion
This file was deleted.

.markdownlint.jsonc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// markdownlint-cli configuration file (cf. https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#configuration)
2+
{
3+
"default": true,
4+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md013.md
5+
"line-length": {
6+
"line_length": 120,
7+
"code_blocks": false,
8+
"tables": false
9+
},
10+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md024.md
11+
"no-duplicate-heading": {
12+
"siblings_only": true
13+
},
14+
// https://docs.github.com/en/get-started/writing-on-github/working-with-advanced-formatting/organizing-information-with-collapsed-sections#creating-a-collapsed-section
15+
// https://github.com/DavidAnson/markdownlint/blob/main/doc/md033.md
16+
"no-inline-html": {
17+
"allowed_elements": ["details", "summary"]
18+
}
19+
}

.markdownlintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.markdownlintignore

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# https://github.com/igorshubovych/markdownlint-cli?tab=readme-ov-file#ignoring-files
2+
vendor/
3+
node_modules/
4+
LICENSE.md
5+
# Drupal
6+
web/*.md
7+
web/core/
8+
web/*/contrib/

Taskfile.yml

Lines changed: 5 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
version: '3'
44

5+
includes:
6+
github-actions: ./task/Tasfile.github-actions.yml
7+
58
vars:
69
GITHUB_ACTIONS_TEMPLATES_HEADER: |
710
# Github Actions templates
@@ -16,63 +19,11 @@ vars:
1619
GITHUB_ACTIONS_TEMPLATES_FOOTER: |
1720
1821
tasks:
19-
github-actions:documentation:update:
20-
desc: "Update GitHub Actions template documentation"
21-
sources:
22-
- github/workflows/*.yaml
23-
generates:
24-
- docs/github-action-templates.md
25-
cmds:
26-
- mkdir -p docs
27-
- |
28-
echo '{{.GITHUB_ACTIONS_TEMPLATES_HEADER}}' > docs/github-action-templates.md
29-
- |
30-
for f in github/workflows/*.yaml; do
31-
echo "" >> docs/github-action-templates.md
32-
echo "---" >> docs/github-action-templates.md
33-
echo "" >> docs/github-action-templates.md
34-
35-
echo "[$f]($f)" >> docs/github-action-templates.md
36-
37-
cat "$f" | grep -E '^###( |$)' | sed -E -e 's/^### ?//' >> docs/github-action-templates.md
38-
done
39-
- |
40-
echo "{{.GITHUB_ACTIONS_TEMPLATES_FOOTER}}" >> docs/github-action-templates.md
41-
# Link to clean up.
42-
- task lint:markdown -- docs/github-action-templates.md
43-
44-
github-actions:update-headers:
45-
prompt: "Updating headers may break things, so check result afterwards. Really update headers?"
46-
desc: "Update headers in GitHub Actions templates"
47-
cmds:
48-
- |
49-
for f in github/workflows/*.yaml; do
50-
echo "$f"
51-
# If file starts with `# ` …
52-
if [[ $(head --lines=1 "$f") =~ "^# " ]]; then
53-
# … replace the header.
54-
# This is done by deleting all lines from the top of the file to a blank line.
55-
docker run --rm --volume=$PWD:/app --user ${COMPOSE_USER:-deploy} itkdev/php8.3-fpm:latest sed -i '1,/^$/d' "$f"
56-
fi
57-
58-
# Write header and file into temporary file.
59-
(
60-
echo "# Do not edit this file! Make a pull request on changing";
61-
echo "# $f in";
62-
echo "# https://github.com/itk-dev/devops_itkdev-docker if need be.";
63-
echo "";
64-
cat "$f"
65-
) > "$f.tmp"
66-
# Replace original file with temporary file.
67-
mv "$f.tmp" "$f"
68-
done
69-
7022
lint:markdown:
7123
desc: "Lint Markdown"
7224
cmds:
73-
# I cannot get itkdev/markdownlint to work as expected, i.e. as peterdavehello/markdownlint does …
74-
- docker run --rm --volume "$PWD":/md peterdavehello/markdownlint markdownlint {{.GLOB}} --fix
75-
- docker run --rm --volume "$PWD":/md peterdavehello/markdownlint markdownlint {{.GLOB}}
25+
- '[[ -n "$SKIP_FIX" ]] || docker run --rm --volume "$PWD":/md itkdev/markdownlint markdownlint {{.GLOB}} --fix'
26+
- docker run --rm --volume "$PWD":/md itkdev/markdownlint markdownlint {{.GLOB}}
7627
vars:
7728
# We use a block scalar (https://yaml-multiline.info/#block-scalars) here to make escaping (a little) easier.
7829
GLOB: >-

config/drupal/php/phpcs.xml

Whitespace-only changes.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?php
2+
// https://github.com/VincentLanglet/Twig-CS-Fixer/blob/main/docs/configuration.md#configuration-file
3+
4+
$finder = new TwigCsFixer\File\Finder();
5+
6+
if (glob('web/*/custom/*/templates')) {
7+
$finder->in('web/*/custom/*/templates');
8+
}
9+
// Include sub-modules or sub-themes
10+
if (glob('web/*/custom/*/*/templates')) {
11+
$finder->in('web/*/custom/*/*/templates');
12+
}
13+
14+
$config = new TwigCsFixer\Config\Config();
15+
$config->setFinder($finder);
16+
17+
return $config;
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)