Skip to content

Document that github.action_repository and github.action_ref are not promised for composite actions #25336

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 May 1, 2023 · 11 comments
Closed
1 task done
Assignees
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

Comments

@jsoref
Copy link
Contributor

jsoref commented May 1, 2023

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

👋 @jsoref - Thanks for opening an issue! And thanks for linking us to the support ticket.

I'll get this triaged for review! ⚡

@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 May 2, 2023
@petergau

This comment was marked as spam.

@github-actions github-actions bot added the stale There is no recent activity on this issue or pull request label Jul 3, 2023
@shiftkey shiftkey moved this to 🆕 New in @shiftkey's backlog Jul 4, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Jul 10, 2023
@jsoref
Copy link
Contributor Author

jsoref commented Jul 10, 2023

@cmwilson21 ?

@cmwilson21 cmwilson21 removed the stale There is no recent activity on this issue or pull request label Jul 11, 2023
@cmwilson21 cmwilson21 reopened this Jul 11, 2023
@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Jul 11, 2023
@cmwilson21 cmwilson21 removed the triage Do not begin working on this issue until triaged by the team label Jul 11, 2023
@cmwilson21
Copy link
Contributor

@jsoref sorry about that! Slipped through during the US holiday last week. 💛

@github-actions github-actions bot added the stale There is no recent activity on this issue or pull request label Sep 11, 2023
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Sep 18, 2023
@jsoref
Copy link
Contributor Author

jsoref commented Sep 18, 2023

@cmwilson21 ...

@cmwilson21 cmwilson21 removed the stale There is no recent activity on this issue or pull request label Sep 19, 2023
@cmwilson21 cmwilson21 reopened this Sep 19, 2023
@github-actions github-actions bot added the triage Do not begin working on this issue until triaged by the team label Sep 19, 2023
@cmwilson21 cmwilson21 removed the triage Do not begin working on this issue until triaged by the team label Sep 19, 2023
@jc-clark
Copy link
Contributor

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."

@jsoref
Copy link
Contributor Author

jsoref commented Sep 26, 2023

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...

@Shahid2687

This comment was marked as spam.

@jc-clark
Copy link
Contributor

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!

@jsoref
Copy link
Contributor Author

jsoref commented Sep 27, 2023

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.

@jc-clark
Copy link
Contributor

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.

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

No branches or pull requests

6 participants
@jsoref @jc-clark @cmwilson21 @Shahid2687 @petergau and others