Skip to content

Commit 051bb95

Browse files
authored
Merge pull request #5 from per1234/sync-task
Use a task for syncing file duplicates
2 parents 1426752 + c8b9527 commit 051bb95

File tree

3 files changed

+35
-17
lines changed

3 files changed

+35
-17
lines changed

.github/workflows/check-sync.yml

+14-4
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# - Assets for the workflow templates used in this repository.
55
#
66
# This workflow checks that the copies are in sync.
7-
# If the workflow fails, run workflow-templates/etc/sync.sh and commit.
7+
# If the workflow fails, run `task dependabot:sync` and commit.
88

99
name: Check File Duplicates Sync
1010

@@ -16,16 +16,26 @@ jobs:
1616
check-sync:
1717
runs-on: ubuntu-latest
1818

19+
env:
20+
SYNC_COMMAND: task dependabot:sync
21+
1922
steps:
2023
- name: Checkout repository
2124
uses: actions/checkout@v2
2225

26+
- name: Install Task
27+
uses: arduino/setup-task@v1
28+
with:
29+
repo-token: ${{ secrets.GITHUB_TOKEN }}
30+
version: 3.x
31+
32+
- name: Sync files
33+
run: ${{ env.SYNC_COMMAND }} --silent
34+
2335
- name: Check file duplicates sync
2436
run: |
25-
SYNC_SCRIPT_PATH="etc/sync.sh"
26-
"${{ github.workspace }}/$SYNC_SCRIPT_PATH"
2737
git add .
2838
if ! git diff --color --exit-code HEAD; then
29-
echo "::error::File duplicates are out of sync. Please run $SYNC_SCRIPT_PATH"
39+
echo "::error::File duplicates are out of sync. Please run \"${{ env.SYNC_COMMAND }}\""
3040
exit 1
3141
fi

Taskfile.yml

+21
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,32 @@
11
version: "3"
22

33
tasks:
4+
fix:
5+
desc: Make automated corrections to the project's files
6+
deps:
7+
- task: dependabot:sync
8+
49
check:
510
desc: Check for problems with the project
611
deps:
712
- task: config:validate
813

14+
dependabot:sync:
15+
desc: Sync workflow duplicates for dependabot checks
16+
vars:
17+
WORKFLOW_TEMPLATES_PATH: "./workflow-templates"
18+
WORKFLOW_TEMPLATE_COPIES_PATH: "./workflow-templates/dependabot/workflow-template-copies/.github/workflows"
19+
cmds:
20+
# Sync workflow templates with the copies in the folder where Dependabot can check them for updates.
21+
- mkdir --parents "{{.WORKFLOW_TEMPLATE_COPIES_PATH}}"
22+
- rm --force "{{.WORKFLOW_TEMPLATE_COPIES_PATH}}"/*
23+
- |
24+
find "{{.WORKFLOW_TEMPLATES_PATH}}" \
25+
-maxdepth 1 \
26+
-type f \
27+
-regex '.*\.ya?ml' \
28+
-exec cp '{}' "{{.WORKFLOW_TEMPLATE_COPIES_PATH}}" \;
29+
930
config:validate:
1031
desc: Validate configuration files against their JSON schema
1132
vars:

etc/sync.sh

-13
This file was deleted.

0 commit comments

Comments
 (0)