Could copilot-setup-steps job also support needs parameter, or some other form of reusable gitops variable sharing?
#176062
Replies: 6 comments
-
|
Yes, you can make a reusable setup job like copilot-setup-steps support needs or share variables GitOps-style, but there are a few nuances depending on how you’re defining it (reusable workflow, composite action, or within a single workflow). |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
Right now the only Git-based options that do work are:
What is not supported:
Until GitHub expands the allowed fields, composite actions are the only reliable way to reuse logic without using environment/organization variables. |
Beta Was this translation helpful? Give feedback.
-
|
Because of this, standard GitHub Actions patterns like:
do not work for What does work today:
What is not supported:
Until GitHub expands the supported fields, composite actions are the only safe way to reuse logic without storing anything in org/environment variables. |
Beta Was this translation helpful? Give feedback.
-
|
Yes, composite action was mostly what I was looking for here. Something like name: get-node-modules-paths
description: Shared variable
outputs:
NODE_MODULES_PATHS:
description: 'Multi-line string of `node_modules` paths to calculate cache hashes'
value: ${{ steps.set.outputs.NODE_MODULES_PATHS }}
runs:
using: 'composite'
steps:
- id: set
# @see https://docs.github.com/en/actions/reference/workflows-and-actions/workflow-commands#multiline-strings
run: |
cat >> $GITHUB_OUTPUT <<'EOF'
NODE_MODULES_PATHS<<DELIMITER
node_modules
apps/*/node_modules
packages/lib/node_modules
DELIMITER
EOF
shell: bashAlthough having now grokked reusable vs composite, in tune with a few other suggestions here, I refactor the whole cache restore step set into a single composite action. |
Beta Was this translation helpful? Give feedback.
-
|
Because of that limitation, cross-job variable sharing simply isn’t possible for What does work today:
Not supported:
Until GitHub expands support for the setup job, composite actions are the only practical and future-proof way to share variables or logic in Copilot’s setup environment. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Select Topic Area
Question
Copilot Feature Area
Copilot Coding Agent
Body
Docs are pretty blunt about this
https://docs.github.com/en/copilot/how-tos/use-copilot-agents/coding-agent/customize-the-agent-environment#preinstalling-tools-or-dependencies-in-copilots-environment
I'm trying to hook in a reusable workflow to restore a small-planet-sized
node_modulesset in a monorepo likeBut
jobs.try-cache-restore.pathvariable is empty becauseneeds, otherwise a standard variable sharing mechanic between jobs, cannot be accessed? What are my Git-based options? I'd like to avoid adding this to GH Variables.Beta Was this translation helpful? Give feedback.
All reactions