actions / actions/runner

Feature parity between composite actions and javascript/docker actions

Open
#2,515 2 comments 5 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
6.3k
Forks
1.4k
Avg merge
1d 16h
Merged PRs (30d)
24

Description

Problem

Composite actions cannot interoperate with javascript actions and docker actions that use non-declarative outputs. From the documentation of javascript and docker actions:

If you don't declare an output in your action metadata file, you can still set outputs and use them in a workflow. For more information on setting outputs in an action, see "Workflow commands for GitHub Actions."

However, this feature is not available to composite actions. That means if a composite action includes an action that exports non-declared outputs, the composite action cannot export those outputs.

The Composite Actions ADR makes a compelling argument for the choice to not expose all outputs from all steps; namely

The reason why we are [not exporting step outputs] is that we don't want to require the workflow author to know the internal workings of the composite action.

This makes sense and we can stay true to this principle while also maintaining feature parity with javascript/docker actions.

Proposal

A natural way to implement this capability would be to allow a developer to choose a step, declared in a parameter called stepOutputs, that exposes all outputs of a given step. As an example, what previously would be written as this:

outputs:
  random-number:
	description: "Random number"
	value: ${{ steps.random-number-generator.outputs.random-id }}
runs:
  using: "composite"
  steps:
	- id: random-number-generator
  	run: echo "::set-output name=random-id::$(echo $RANDOM)"
  	shell: bash

, could now be written as this:

stepOutputs: gather-outputs
runs:
  using: "composite"
  steps:
	- id: random-number-generator
  	run: echo "::set-output name=random-id::$(echo $RANDOM)"
  	shell: bash
	- id: gather-outputs
  	run: echo "::set-output name=random-number::${{ steps.random-number-generator.outputs.random-id }}"
  	shell: bash

This gives us two properties:

  1. We don't expose the internals of the composite action (random-id is not exported).
  2. We can expose a dynamic set of outputs

Furthermore, it is a literal extension of the guiding principles of composite actions:

A composite action is treated as one individual job step (this is known as encapsulation).

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the Composite Actions ADR and the metadata documentation linked in the issue, then trace how composite action outputs are currently defined and exposed in the runner. Done means a composite action can select a step whose dynamic outputs are exposed without exporting the composite action's internal step outputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, github-actions
Domain
ci-cd
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.