-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathTaskfile.yml
77 lines (70 loc) · 2.61 KB
/
Taskfile.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
version: "3"
tasks:
fix:
desc: Make automated corrections to the project's files
deps:
- task: ci:sync
- task: config:sync
- task: dependabot:sync
check:
desc: Check for problems with the project
deps:
- task: general:check-formatting
- task: config:validate
general:check-formatting:
desc: Check basic formatting style of all files
cmds:
- |
if ! which ec &>/dev/null; then
echo "ec not found or not in PATH. Please install: https://github.com/editorconfig-checker/editorconfig-checker#installation"
exit 1
fi
- ec
ci:sync:
desc: Sync CI workflows from templates
vars:
WORKFLOWS_PATH: "./.github/workflows"
WORKFLOW_TEMPLATES_PATH: "./workflow-templates"
cmds:
- |
cp \
"{{.WORKFLOW_TEMPLATES_PATH}}/check-general-formatting-task.yml" \
"{{.WORKFLOWS_PATH}}"
config:sync:
desc: Sync configuration files from templates
vars:
REPOSITORY_ROOT_PATH: "./"
WORKFLOW_TEMPLATE_ASSETS_PATH: "./workflow-templates/assets"
cmds:
- |
cp \
"{{.WORKFLOW_TEMPLATE_ASSETS_PATH}}/shared/.editorconfig" \
"{{.REPOSITORY_ROOT_PATH}}"
dependabot:sync:
desc: Sync workflow duplicates for dependabot checks
vars:
WORKFLOW_TEMPLATES_PATH: "./workflow-templates"
WORKFLOW_TEMPLATE_COPIES_PATH: "./workflow-templates/dependabot/workflow-template-copies/.github/workflows"
cmds:
# Sync workflow templates with the copies in the folder where Dependabot can check them for updates.
- mkdir --parents "{{.WORKFLOW_TEMPLATE_COPIES_PATH}}"
- rm --force "{{.WORKFLOW_TEMPLATE_COPIES_PATH}}"/*
- |
find "{{.WORKFLOW_TEMPLATES_PATH}}" \
-maxdepth 1 \
-type f \
-regex '.*\.ya?ml' \
-exec cp '{}' "{{.WORKFLOW_TEMPLATE_COPIES_PATH}}" \;
config:validate:
desc: Validate configuration files against their JSON schema
vars:
# Last version with support for draft-04, used by Dependabot schema
AJV_CLI_VERSION: 3.3.0
# Source: https://github.com/SchemaStore/schemastore/blob/master/src/schemas/json/dependabot-2.0.json
DEPENDABOT_SCHEMA_URL: https://json.schemastore.org/dependabot-2.0
DEPENDABOT_SCHEMA_PATH:
sh: mktemp -t dependabot-schema-XXXXXXXXXX.json
DEPENDABOT_DATA_PATH: "**/dependabot.yml"
cmds:
- wget --quiet --output-document="{{.DEPENDABOT_SCHEMA_PATH}}" {{.DEPENDABOT_SCHEMA_URL}}
- npx ajv-cli@{{.AJV_CLI_VERSION}} validate -s "{{.DEPENDABOT_SCHEMA_PATH}}" -d "{{.DEPENDABOT_DATA_PATH}}"