Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task done
jsoref opened this issue Sep 8, 2022 · 16 comments · Fixed by #29641
Closed
1 task done

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

jsoref opened this issue Sep 8, 2022 · 16 comments · Fixed by #29641
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team help wanted Anyone is welcome to open a pull request to fix this issue

Comments

@jsoref
Copy link
Contributor

jsoref commented Sep 8, 2022

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]
@jsoref jsoref added the content This issue or pull request belongs to the Docs Content team label Sep 8, 2022
@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Sep 8, 2022
@jsoref
Copy link
Contributor Author

jsoref commented Sep 8, 2022

The working example is apparently commercialhaskell/stack@ba70082
Updated based on the deprecation of ::set-output: commercialhaskell/stack@963ba33

https://github.com/commercialhaskell/stack/blob/1931538a4a3e5058d9432bff68b397c6804a96f2/.github/workflows/integration-tests.yml#L163

          echo "arm64=['self-hosted', 'linux', 'ARM64']" >> $GITHUB_OUTPUT

https://github.com/commercialhaskell/stack/blob/ba7008251f8bcec6ac0bd11f26031b760b7d68e6/.github/workflows/integration-tests.yml#L122

    runs-on: ${{ fromJSON(needs.configuration.outputs.arm64) }}

@cmwilson21 cmwilson21 added actions This issue or pull request should be reviewed by the docs actions team waiting for review Issue/PR is waiting for a writer's review and removed triage Do not begin working on this issue until triaged by the team labels Sep 9, 2022
@cmwilson21
Copy link
Contributor

👋 @jsoref Thanks for opening an issue. We appreciate all the details, too.

I'll get this triaged for review. ⚡

@lucascosti lucascosti added the needs SME This proposal needs review from a subject matter expert label Nov 2, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Nov 2, 2022

Thanks for opening an issue! We've triaged this issue for technical review by a subject matter expert 👀

@github-actions
Copy link
Contributor

github-actions bot commented Dec 9, 2022

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added the SME stale The request for an SME has staled label Dec 9, 2022
@cmwilson21 cmwilson21 removed the SME stale The request for an SME has staled label Dec 9, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Jan 7, 2023

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added the SME stale The request for an SME has staled label Jan 7, 2023
@ray2glicense

This comment was marked as spam.

@github-actions github-actions bot removed the SME stale The request for an SME has staled label Jan 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 7, 2023

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added the SME stale The request for an SME has staled label Feb 7, 2023
@cmwilson21 cmwilson21 removed the SME stale The request for an SME has staled label Feb 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Mar 8, 2023

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added the SME stale The request for an SME has staled label Mar 8, 2023
@cmwilson21 cmwilson21 removed the SME stale The request for an SME has staled label Mar 8, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Apr 6, 2023

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added the SME stale The request for an SME has staled label Apr 6, 2023
@Mashudaamri
Copy link

Help me establish a link to github for an otp on the missing simcard

@github-actions github-actions bot removed the SME stale The request for an SME has staled label Apr 11, 2023
@github-actions
Copy link
Contributor

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added the SME stale The request for an SME has staled label May 10, 2023
@cmwilson21 cmwilson21 removed the SME stale The request for an SME has staled label May 11, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jun 8, 2023

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added the SME stale The request for an SME has staled label Jun 8, 2023
@cmwilson21 cmwilson21 removed the SME stale The request for an SME has staled label Jun 9, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Jul 7, 2023

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added SME stale The request for an SME has staled and removed SME stale The request for an SME has staled labels Jul 7, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Aug 6, 2023

This is a gentle bump for the docs team that this issue is waiting for technical review.

@github-actions github-actions bot added the SME stale The request for an SME has staled label Aug 6, 2023
@cmwilson21 cmwilson21 removed the SME stale The request for an SME has staled label Aug 7, 2023
@hubwriter
Copy link
Contributor

I've had a look at this but am not familiar enough with this area to know whether, where, and how this should be documented, so I've asked for some SME assistance. Hopefully we can move this issue along soon.

@hubwriter
Copy link
Contributor

The answer I've had on this is that the strings provided as the value of runs-on can be quoted but don't need to be where a simple word is used, like:

runs-on: [self-hosted, linux, x64, gpu]

Expressions must be quoted:

runs-on: [self-hosted, "${{ inputs.chosen-os }}"]

Perhaps to resolve this issue we could add some clarification of this to the syntax details for runs-on:
https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on

@hubwriter hubwriter added help wanted Anyone is welcome to open a pull request to fix this issue and removed waiting for review Issue/PR is waiting for a writer's review needs SME This proposal needs review from a subject matter expert labels Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
actions This issue or pull request should be reviewed by the docs actions team content This issue or pull request belongs to the Docs Content team help wanted Anyone is welcome to open a pull request to fix this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

9 participants
@jsoref @lucascosti @hubwriter @cmwilson21 @ray2glicense @Mashudaamri and others