Skip to content
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

Add environment name expression example #23816

Merged
merged 5 commits into from
May 25, 2023
Merged

Conversation

ssyberg
Copy link
Contributor

@ssyberg ssyberg commented Feb 9, 2023

I spent hours and hours figuring this out on my own, I hope this saves someone else a day! Would also like someone at github to actually clarify what contexts are available here.

Why:

Documentation on use of expessions in the name value of environment incomplete / missing completely from any Github Actions related docs.

The name attribute can actually be an expression but the available contexts are not currently documented (this issue persists even after my changes).

environment:
  name: ${{ github.ref_name }}

What's being changed (if available, include any code snippets, screenshots, or gifs):

Documentation

Check off the following:

  • I have reviewed my changes in staging (look for the "Automatically generated comment" and click the links in the "Preview" column to view your latest changes).
  • For content changes, I have completed the self-review checklist.

I spent hours and hours figuring this out on my own, I hope this saves someone else a day! Would also like someone at github to actually clarify what contexts are available here.
@welcome
Copy link

welcome bot commented Feb 9, 2023

Thanks for opening this pull request! A GitHub docs team member should be by to give feedback soon. In the meantime, please check out the contributing guidelines.

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

@ssyberg Thanks for opening an issue. We appreciate your interest in improving the Docs! ✨

I'll get this triaged, but would you mind filling in a bit more information in the "Why" section above? A bit more context about the problem you are solving with this submission will really help us in the review process.

Thank you! 👍

@ssyberg
Copy link
Contributor Author

ssyberg commented Feb 9, 2023

"Why" section above? A bit more context about the problem you are solving with this submission will really help us in the review process.

Sure, not much to say that isn't in the content change itself but I added it above as well.

@cmwilson21
Copy link
Contributor

This is super helpful! Thank you! ✨

@Omar1688

This comment was marked as spam.

@@ -27,3 +27,13 @@ environment:
url: ${{ steps.step_id.outputs.url_output }}
```
{% endraw %}

The `name` can also be an expression but the available contexts are not currently documented.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but the available contexts are not currently documented.

I've asked the Actions team about this so that we can provide the details of contexts.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Contexts for name:
"github","inputs","vars","needs","strategy","matrix"

See: https://github.com/actions/languageservices/blob/main/workflow-parser/src/workflow-v1.0.json#L1965-L1973


For precision, we should also update the contexts for url to give the actual list of contexts, rather than say "except for the secrets context".

"github","inputs","vars","needs","strategy","matrix","steps","job","runner","env"

See: https://github.com/actions/languageservices/blob/main/workflow-parser/src/workflow-v1.0.json#L2456-L2467


jobs.<job_id>.concurrency has the same set of contexts as name (https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idconcurrency) so we should update this also - replacing "except for the secrets context".

See: https://github.com/actions/languageservices/blob/main/workflow-parser/src/workflow-v1.0.json#L1903-L1913

Copy link
Contributor

@hubwriter hubwriter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ssyberg - Many thanks for raising this PR to improve the docs.

I'm sorry it's taken us so long to get to reviewing it.

After checking with the Actions team, I've added details about the contexts for expressions used for name - and, on advice, I've also changed the contexts information in a couple of other places.

A tip I was given, which might be helpful if you use VS Code, is that, with the Actions extension for VS Code, you can find out context information in a tooltip when you hover over a keyword:

image

@hubwriter
Copy link
Contributor

Merging this now. 🚢

@hubwriter hubwriter added this pull request to the merge queue May 25, 2023
Merged via the queue into github:main with commit 4d65103 May 25, 2023
25 checks passed
@github-actions
Copy link
Contributor

Thanks very much for contributing! Your pull request has been merged 🎉 You should see your changes appear on the site in approximately 24 hours. If you're looking for your next contribution, check out our help wanted issues

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 waiting for review Issue/PR is waiting for a writer's review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants