Skip to content

fromJSON should include an example of an array for runs-onΒ #20495

Closed
@jsoref

Description

@jsoref

Maintainer's note

We researched the question raised by this issue and provided clarification in this comment: #20495 (comment)

To open a PR against this issue, please add clarification of this syntax in the "jobs.<job_id>.runs-on" section of the "Workflow syntax for GitHub Actions" article.

Code of Conduct

What article on docs.github.com is affected?

https://docs.github.com/en/actions/learn-github-actions/expressions#fromjson
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on

What part(s) of the article would you like to see updated?

Add an example-returning-a-runs-on-array similar to https://docs.github.com/en/actions/learn-github-actions/expressions#example-returning-a-json-object

Additional information

Normally in JSON, the basic types are:

  • null
  • booleans
  • numbers
  • strings
  • arrays
  • maps

In GitHub Workflows, strings are strange in that, maybe? they don't need to be wrapped in quotes, some of the time?

Except, in the example https://docs.github.com/en/actions/learn-github-actions/expressions#example-returning-a-json-object, keys and values are wrapped in quotes:

        run: echo "::set-output name=matrix::{\"include\":[{\"project\":\"foo\",\"config\":\"Debug\"},{\"project\":\"bar\",\"config\":\"Release\"}]}"

When I tried to add some magic for a dynamic runs-on that would sometimes be a string and sometimes be an array, I naively assumed that I'd need to wrap my array elements in quotes, but that didn't do the right thing.

See this PR:
commercialhaskell/stack#5856 (comment)

We can't seem to get this to work...

merge change https://github.com/commercialhaskell/stack/runs/8254107160?check_suite_focus=true

Requested labels: [self-hosted, linux, ARM64]
Job defined at: commercialhaskell/stack/.github/workflows/integration-tests.yml@refs/pull/5856/merge
Waiting for a runner to pick up this job...

merge change https://github.com/commercialhaskell/stack/runs/8254719771?check_suite_focus=true

Requested labels: "[self-hosted, linux, ARM64]"
Job defined at: commercialhaskell/stack/.github/workflows/integration-tests.yml@refs/pull/5856/merge
Waiting for a runner to pick up this job...

merge change https://github.com/commercialhaskell/stack/runs/8255017367?check_suite_focus=true

Requested labels: ["self-hosted", "linux", "ARM64"]
Job defined at: commercialhaskell/stack/.github/workflows/integration-tests.yml@refs/pull/5856/merge
Waiting for a runner to pick up this job...

merge change https://github.com/commercialhaskell/stack/runs/8255163889?check_suite_focus=true

Requested labels: [self-hosted, linux, ARM64]
Job defined at: commercialhaskell/stack/.github/workflows/integration-tests.yml@refs/pull/5856/merge
Waiting for a runner to pick up this job...

The last output appears to match the output for the working world
workflow https://github.com/commercialhaskell/stack/runs/8255316015?check_suite_focus=true

    runs-on: [self-hosted, linux, ARM64]

Metadata

Metadata

Assignees

No one assigned

    Labels

    actionsThis issue or pull request should be reviewed by the docs actions teamcontentThis issue or pull request belongs to the Docs Content teamhelp wantedAnyone is welcome to open a pull request to fix this issue

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions