Skip to content

Commit ed9616f

Browse files
committed
Use a dedicated workflow for each sync type
The approach inherited from the original Bash script-based approach to syncing the repository's file duplicates was to handle all syncing in a monolithic manner. As I convert this to a task-based aproach, I have decided that there really isn't enough in common between the types of files synced, nor their sync method, to justify combining them. Splitting them up allows for path filters on the workflow triggers and more meaningful results in the event of a failure.
1 parent 051bb95 commit ed9616f

File tree

3 files changed

+50
-42
lines changed

3 files changed

+50
-42
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# This repository contains intentionally duplicated copies of template workflows under
2+
# workflow-templates/dependabot/workflow-template-copies used for Dependabot checks.
3+
#
4+
# This workflow checks that the copies are in sync.
5+
# If the workflow fails, run `task dependabot:sync` and commit.
6+
7+
name: Check Workflow Duplicates Sync
8+
9+
on:
10+
push:
11+
paths:
12+
- ".github/workflows/check-dependabot-sync.ya?ml"
13+
- "Taskfile.yml"
14+
- "workflow-templates/*.ya?ml"
15+
- "workflow-templates/dependabot/workflow-template-copies/.github/workflows/*"
16+
pull_request:
17+
paths:
18+
- ".github/workflows/check-dependabot-sync.ya?ml"
19+
- "Taskfile.yml"
20+
- "workflow-templates/*.ya?ml"
21+
- "workflow-templates/dependabot/workflow-template-copies/.github/workflows/*"
22+
23+
jobs:
24+
check-sync:
25+
runs-on: ubuntu-latest
26+
27+
env:
28+
SYNC_COMMAND: task dependabot:sync
29+
30+
steps:
31+
- name: Checkout repository
32+
uses: actions/checkout@v2
33+
34+
- name: Install Task
35+
uses: arduino/setup-task@v1
36+
with:
37+
repo-token: ${{ secrets.GITHUB_TOKEN }}
38+
version: 3.x
39+
40+
- name: Sync workflows
41+
run: ${{ env.SYNC_COMMAND }} --silent
42+
43+
- name: Check workflow duplicates sync
44+
run: |
45+
git add .
46+
if ! git diff --color --exit-code HEAD; then
47+
echo "::error::Workflow duplicates are out of sync. Please run \"${{ env.SYNC_COMMAND }}\""
48+
exit 1
49+
fi

.github/workflows/check-sync.yml

-41
This file was deleted.

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[![Check Configuration Files status](https://github.com/arduino/tooling-project-assets/actions/workflows/check-configuration-files.yml/badge.svg)](https://github.com/arduino/tooling-project-assets/actions/workflows/check-configuration-files.yml)
44
[![Check License status](https://github.com/arduino/tooling-project-assets/actions/workflows/check-license.yml/badge.svg)](https://github.com/arduino/tooling-project-assets/actions/workflows/check-license.yml)
5-
[![Check File Duplicates Sync status](https://github.com/arduino/tooling-project-assets/actions/workflows/check-sync.yml/badge.svg)](https://github.com/arduino/tooling-project-assets/actions/workflows/check-sync.yml)
5+
[![Check Workflow Duplicates Sync status](https://github.com/arduino/tooling-project-assets/actions/workflows/check-dependabot-sync.yml/badge.svg)](https://github.com/arduino/tooling-project-assets/actions/workflows/check-dependabot-sync.yml)
66

77
The [Arduino](https://www.arduino.cc/) Tooling Team's collection of reusable project infrastructure assets.
88

0 commit comments

Comments
 (0)