function in runs-on doesn't work
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 6.3k
- Forks
- 1.4k
- Avg merge
- 1d 16h
- Merged PRs (30d)
- 24
Description
Describe the bug
I have the workflow listen on event deployment for app deployment.
I'd like to reuse the same workflow for both nonprod and prod.
that means i have to use variable as runner label in runs-on statement.
however, runs-on doesn't support func call:
Not work
runs-on: ["${{ fromJson(github.event.deployment.payload).runnerLabel }}"] results in runs-on: [""]
Work
runs-on: ["${{ github.event.deployment.description }}"] results in runs-on: ["prod"]
assume description has the right runner label value
To Reproduce
Steps to reproduce the behavior:
name: CD
on: ['deployment']
jobs:
deploy:
name: Deploy
runs-on: ["${{ fromJson(github.event.deployment.payload).runnerLabel }}"]
steps:
...
the workflow failed says no runner matched. "${{ fromJson(github.event.deployment.payload).runnerLabel }}" results in an empty string.
Expected behavior
expect the value being correctly extracted from json, like runs-on: ["prod"]
Runner Version and Platform
Version of your runner?
2.273.5
OS of the machine running the runner? OSX/Windows/Linux/...
Ubuntu 20.04
What's not working?
Please include error messages and screenshots.
Job Log Output
N/A
Runner and Worker's Diagnostic Logs
N/A
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the deployment-triggered workflow from the issue using runner version 2.273.5 and compare the fromJson expression with the direct description value in runs-on. Trace the runner's workflow-expression handling to determine why runnerLabel becomes empty; done when the JSON value resolves to a runner label and the job selects the expected runner.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- github-actions
- Domain
- ci-cd
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100