Skip to content

Commit d4f9986

Browse files
committed
Added and checked file headers
1 parent 8d03e0d commit d4f9986

File tree

5 files changed

+50
-0
lines changed

5 files changed

+50
-0
lines changed

.github/workflows/documentation.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,15 @@ jobs:
1212
# Check that documentation has not changed.
1313
- run: |
1414
git diff --exit-code docs/github-action-templates.md
15+
16+
check-github-actions-documentation:
17+
runs-on: ubuntu-latest
18+
name: Check that Github Actions documentation is up to date
19+
steps:
20+
- uses: actions/checkout@v4
21+
- uses: arduino/setup-task@v2
22+
- run: |
23+
task github-actions:update-headers --yes
24+
# Check that files hav not changed.
25+
- run: |
26+
git diff --exit-code github/workflows/

Taskfile.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,32 @@ tasks:
4141
# Link to clean up.
4242
- task lint:markdown -- docs/github-action-templates.md
4343

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 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+
4470
lint:markdown:
4571
desc: "Lint Markdown"
4672
cmds:

github/workflows/composer.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/composer.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
15
### ## Composer
26
###
37
### Validates composer.json and checks that it's normalized.

github/workflows/drupal.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/drupal.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
15
### ## Drupal
26
###
37
### Checks that site can be installed and can be updated (from base branch on

github/workflows/markdown.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# Do not edit this file! Make a pull request on changing
2+
# github/workflows/markdown.yaml in
3+
# https://github.com/itk-dev/devops_itkdev-docker if need be.
4+
15
### ## Markdown
26
###
37
### Uses [itkdev/markdownlint](https://hub.docker.com/r/itkdev/markdownlint) to

0 commit comments

Comments
 (0)