Skip to content

Commit 5281434

Browse files
authored
Composite Actions Support ADR (#1144)
Composite Actions ADR
1 parent e9a8bf2 commit 5281434

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

docs/adrs/1144-composite-actions.md

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
**Date**: 2021-06-10
2+
3+
**Status**: Accepted
4+
5+
## Context
6+
7+
We released [composite run steps](https://github.com/actions/runner/pull/554) last year which started our journey of reusing steps across different workflow files. To continue that journey, we want to expand composite run steps into composite actions.
8+
9+
We want to support the `uses` steps from workflows in composite actions, including:
10+
- Container actions
11+
- Javascript actions
12+
- Other Composite actions (up to a limit of course!)
13+
- The pre and post steps these actions can generate
14+
15+
## Guiding Principles
16+
17+
- Composite Actions should function as a single step or action, no matter how many steps it is composed of or how many levels of recursion it has
18+
- In the future we may add a configurable option to make this no longer the case
19+
- A workflow author should not need to understand the inner workings of a composite action in order to use it
20+
- Composite actions should leverage inputs to get values they need, they will not have full access to the `context` objects. The secrets context will **not** be available to composite actions, users will need to pass these values in as an input.
21+
- Other Actions should **just work** inside a composite action, without any code changes
22+
23+
## Decisions
24+
25+
### Composite Recursion Limit
26+
27+
- We will start with supporting a recursion limit of `10` composite actions deep
28+
- We are free to bump this limit in the future, the code will be written to just require updating a variable. If the graph evaluates beyond the recursion limit, the job will fail in the pre-job phase (The `Set up job` step).
29+
- A composite actions interface is its inputs and outputs, nothing else is carried over when invoking recursively.
30+
31+
### Pre/Post Steps in nested Actions
32+
33+
- We do not plan on adding the ability to configure a customizable pre or post step for composite actions at this time. However, we will execute the pre and post steps of any actions referenced in a composite action.
34+
- Composite actions will generate a single pre-step and post-step for the entire composite action, even if there are multiple pre-steps and post-steps in the referenced actions.
35+
- These steps will execute following the same ordering rules we have today, first to run has their pre step run first and their post step run last.
36+
- For example, if you had a composite action with two pre steps and two posts steps:
37+
38+
```
39+
- uses: action1
40+
- uses: composite1
41+
- uses: action2
42+
```
43+
44+
The order of execution would be:
45+
46+
```
47+
- prestep-action1
48+
- prestep-composite1
49+
- prestep-composite1-first-action-referenced
50+
- prestep-composite1-second-action-referenced
51+
- prestep-action2
52+
- the job steps
53+
- poststep-action2
54+
- poststep-composite1
55+
- poststep-composite1-the-second-action-referenced
56+
- poststep-composite1-first-action-referenced
57+
- poststep-action1
58+
```
59+
60+
#### Set-state
61+
62+
- While the composite action has an individual combined pre/post action, the `set-state` command will not be shared.
63+
- If the `set-state` command is used during a composite step, only the action that originally called `set-state` will have access to the env variable during the post run step.
64+
- This prevents multiple actions that set the same state from interfering with the execution of another action's post step.
65+
66+
### Resolve Action Endpoint changes
67+
68+
- The resolve actions endpoint will now validate policy to ensure that the given workflow run has access to download that action.
69+
- Older GHES/GHAE customers with newer runners will be locked out of composite uses steps until they upgrade their instance.
70+
71+
### Local actions
72+
- Local actions will expand the tree, perform policy checks, and download actions Just in Time when the step is running.
73+
- Like current local actions, we will not support presteps. If an action is running local, by the time we know that, the time to run presteps have already passed.
74+
75+
### If, continue-on-error, timeout-minutes - Not being considered at this time
76+
77+
- `if`, `continue-on-error`, `timeout-minutes` could be supported in composite run/uses steps. These values were not originally supported in our composite run steps implementation.
78+
- Browsing the community forums and runner repo, there hasn't been a lot of noise asking for these features, so we will hold off on them.
79+
- These values passed as input into the composite action will **not** be carried over as input into the individual steps the composite action runs.
80+
81+
### Defaults - Not being considered at this time
82+
83+
- In actions, we have the idea of [defaults](https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#defaultsrun) , which allow you to specify a shell and working directory in one location, rather then on each step.
84+
- However, `shell` is currently required in composite run steps
85+
- In regular run steps, it is optional, and defaults to a different value based on the OS.
86+
- We want to prioritize the right experience for the consumer, and make the action author continue to explicitly set these values. We can consider improving this experience in the future.
87+
88+
## Consequences
89+
90+
- Workflows are now more reusable across multiple workflow files
91+
- Composite actions implement most of the existing workflow run steps, with room to expand these in the future
92+
- Feature flags will control this rollout

0 commit comments

Comments
 (0)