docs
docs copied to clipboard
Document that `github.action_repository` and `github.action_ref` are not promised for composite actions
Code of Conduct
- [X] I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
What part(s) of the article would you like to see updated?
| github.action_ref
| string
| For a step executing an action, this is the ref of the action being executed. For example, v2
. |
| github.action_repository
| string
| For a step executing an action, this is the owner and repository name of the action. For example, actions/checkout
. |
Need to specify that they are not promised to work for composite actions.
(This is bizarre, but this is the information I received from GitHub support)
Additional information
https://support.github.com/ticket/personal/0/2042233#tc-15297292650900
👋 @jsoref - Thanks for opening an issue! And thanks for linking us to the support ticket.
I'll get this triaged for review! :zap:
Code of Conduct
- [X] I have read and agree to the GitHub Docs project's Code of Conduct
What article on docs.github.com is affected?
https://docs.github.com/en/actions/learn-github-actions/contexts#github-context
What part(s) of the article would you like to see updated?
|
github.action_ref
|string
| For a step executing an action, this is the ref of the action being executed. For example,v2
. ||
github.action_repository
|string
| For a step executing an action, this is the owner and repository name of the action. For example,actions/checkout
. |Need to specify that they are not promised to work for composite actions.
(This is bizarre, but this is the information I received from GitHub support)
Additional information
https://support.github.com/ticket/personal/0/2042233#tc-15297292650900
@cmwilson21 ?
@jsoref sorry about that! Slipped through during the US holiday last week. 💛
@cmwilson21 ...
Thanks for hanging in there with us while we're working through the backlog of issues @jsoref. I took a look through this and agree that this would be a good addition to the docs.
What do you think about adding the following sentence to each of the github.action_ref
and github.action_repository
descriptions?
This context does not work for composite actions. For more information, see "Creating a composite action."
Since ~1/5 of all issues in the backlog are mine, I'm ok w/ that. I'm also fairly tolerant of delays (much less of annoying bots that attack my tickets).
I really should have left a better breadcrumbs for this problem. I'm pretty sure I worked around it, but I clearly didn't document how.
Our engineering team determined that the github.action_repository and github.actions_ref [sic] context values are only intended to work with non-composite actions.
For now, reverting to using these contexts only from the
env
key within the composite action will achieve the expected values. Alternatively, you can leverage inputs with your custom action to ensure the value is consistent if needed in a run command.
It looks like the workaround is to do:
run: echo "$action_ref"
env:
action_ref: ${{ github.action_ref }}
instead of:
run: echo "${{ github.action_ref }}"
As the creating page doesn't mention env
/ run
and doesn't encourage using the former (it probably should), I don't know that the link is helpful right now...
Good
Ah I see what you're saying here, and really appreciate the extra breadcrumbs. What do you think about adding this revision for the github.action_ref
and github.action_repository
descriptions?
To make this context work with composite actions, reference it within the
env
context of the composite action.
I might be missing the mark here, so let me know if alternate wording would make more sense!
That might work. It might be worth it to be more explicit and mention "and not run
".
It might even be useful to generally suggest not using it in run
. In general, it's a bad idea/practice to expand things into run
.
If I were you, I'd talk with engineering a bit more about the wording. Sorry.
No problem, @jsoref. Thank you for the pointers. This gives me a really good starting point.
I'll go ahead open up an internal issue to make these improvements and close this one out. I'll be able to coordinate with the engineers from there.