Lazy variable evaluation ? #173194
Replies: 3 comments
-
|
If this is GitHub.com Actions (this is too new for GHES right now, hosted enterprise edition might work as well), you could also use yaml anchors if your concern is repeating this in your yaml file, otherwise https://github.com/orgs/community/discussions/173194#discussioncomment-14407410 is better. Or even combine both, create your own composite action etc.. name: test
on:
push:
jobs:
test:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: &checkout actions/checkout@v2 # Update this to v5 and every job that has *checkout will see the change
- name: test
run: |
echo ${{ env.test }}
env:
test: &test ${{ runner.os }}-${{ hashFiles('.python-version') }}
test2:
runs-on: ubuntu-22.04
steps:
- name: checkout
uses: *checkout # share version of checkout
- name: test
run: |
echo ${{ env.test }}
env:
test: *test # alias for anchor &test, can be reused over and over again
Only if it is not a requirement to specify this in the global env, thing |
Beta Was this translation helpful? Give feedback.
This comment was marked as off-topic.
This comment was marked as off-topic.
-
|
🕒 Discussion Activity Reminder 🕒 This Discussion has been labeled as dormant by an automated system for having no activity in the last 60 days. Please consider one the following actions: 1️⃣ Close as Out of Date: If the topic is no longer relevant, close the Discussion as 2️⃣ Provide More Information: Share additional details or context — or let the community know if you've found a solution on your own. 3️⃣ Mark a Reply as Answer: If your question has been answered by a reply, mark the most helpful reply as the solution. Note: This dormant notification will only apply to Discussions with the Thank you for helping bring this Discussion to a resolution! 💬 |
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.
-
Why are you starting this discussion?
Question
What GitHub Actions topic or product is this about?
Actions Runner
Discussion Details
Hello,
I try to find a way to do lazy evaluation but didn't find a working example nor know if it is possible.
I'm looking to do something like:
Is there any way to achieve this ?
Thanks,
Regards,
Beta Was this translation helpful? Give feedback.
All reactions