Skip to content

Commit 4cf7b0f

Browse files
authored
Merge pull request #19 from LibreCodeCoop/docs/workflow-adoption-model
docs: define workflow adoption model
2 parents 5ccac80 + 24bdc2c commit 4cf7b0f

1 file changed

Lines changed: 111 additions & 0 deletions

File tree

‎docs/workflow-adoption-model.md‎

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<!--
2+
SPDX-FileCopyrightText: 2026 LibreCode coop and contributors
3+
SPDX-License-Identifier: AGPL-3.0-or-later
4+
-->
5+
6+
# Workflow adoption model
7+
8+
Use this guide when adding or migrating automation into `LibreCodeCoop/github-workflows`.
9+
10+
## Default preference
11+
12+
Prefer the option that centralizes implementation without hiding repository-specific behavior.
13+
14+
The decision order is:
15+
16+
1. reusable workflow;
17+
2. composite action;
18+
3. installed organization workflow template.
19+
20+
A copied template is not the default merely because an upstream project publishes one.
21+
22+
## Reusable workflow
23+
24+
Prefer a reusable workflow when the whole job or workflow can be expressed behind a stable caller contract.
25+
26+
Good fit:
27+
28+
- CI orchestration shared by many repositories;
29+
- release or validation flows with well-defined inputs and secrets;
30+
- behavior that should receive fixes centrally without copying implementation;
31+
- permissions and secrets can be declared clearly at the caller boundary.
32+
33+
Avoid when:
34+
35+
- the repository must own event-specific structure that cannot be expressed cleanly by the caller;
36+
- callers need to change internal jobs/steps rather than inputs;
37+
- GitHub reusable-workflow limitations prevent required nesting, secrets or environment behavior.
38+
39+
A caller should remain intentionally small.
40+
41+
## Composite action
42+
43+
Prefer a composite action when the reusable unit is a sequence of steps inside a job rather than the workflow itself.
44+
45+
Good fit:
46+
47+
- setup;
48+
- validation helpers;
49+
- deterministic transformations;
50+
- repeated command sequences with a stable input/output contract.
51+
52+
Keep non-trivial parsing and business rules in tested code invoked by the action rather than large shell blocks.
53+
54+
## Organization workflow template
55+
56+
Use an installed template when the consumer repository genuinely needs to own the workflow file.
57+
58+
Good fit:
59+
60+
- event declarations belong to the repository;
61+
- repository-level customization is expected;
62+
- GitHub cannot express the needed abstraction as a reusable workflow;
63+
- developers benefit from discovering/installing the workflow through **Actions -> New workflow**.
64+
65+
A managed template must have:
66+
67+
- organization catalog metadata;
68+
- provenance;
69+
- deterministic generation when derived from upstream;
70+
- explicit LibreCode patches;
71+
- a consumer update path;
72+
- divergence protection when centrally synchronized.
73+
74+
## Upstream-derived workflows
75+
76+
Do not automatically mirror an upstream template as a LibreCode template.
77+
78+
For every upstream workflow, review:
79+
80+
1. whether the implementation should instead become a reusable workflow;
81+
2. runner labels;
82+
3. owner/organization checks;
83+
4. permissions;
84+
5. credentials and environments;
85+
6. third-party actions;
86+
7. assumptions about repository layout;
87+
8. local patch requirements;
88+
9. license and branding assets.
89+
90+
Shared LibreCode behavior belongs in `github-workflows`, not in repeated consumer-local patches.
91+
92+
## Versioning
93+
94+
Reusable workflows and actions are code dependencies and should be referenced through a deliberate versioning policy.
95+
96+
Installed templates are copied artifacts. Their source revision is tracked centrally, while consumers are updated through reviewable synchronization PRs.
97+
98+
Do not mix these models implicitly.
99+
100+
## Review checklist
101+
102+
Before accepting a new shared workflow:
103+
104+
- Can the implementation be centralized as a reusable workflow?
105+
- If not, is a composite action the reusable unit?
106+
- If a template is required, why must the workflow file remain consumer-owned?
107+
- Is repository-specific variability represented as explicit inputs/configuration rather than forks?
108+
- Are substantial scripts extracted into tested code?
109+
- Are permissions least-privilege?
110+
- Are third-party actions pinned according to project policy?
111+
- Does the consumer have a documented update and divergence path?

0 commit comments

Comments
 (0)