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

[Bug] Does not work in reusable workflows #5

Open
qoomon opened this issue Aug 1, 2024 · 6 comments
Open

[Bug] Does not work in reusable workflows #5

qoomon opened this issue Aug 1, 2024 · 6 comments
Labels

Comments

@qoomon
Copy link

qoomon commented Aug 1, 2024

the job id can not be determined if the action is part of a reusable workflow.

The problem seems to be that the actual job name is something like <main workflow job> / <reusable workflow job>

@daleyjem
Copy link
Owner

daleyjem commented Oct 5, 2024

Thanks @qoomon
I'll see if I can figure out what you mean, but in the meantime, can you provide some more reproducibility details? I haven't used reusable workflows before?

@daleyjem daleyjem added bug Something isn't working help wanted Extra attention is needed good first issue Good for newcomers question Further information is requested labels Oct 5, 2024
@daleyjem
Copy link
Owner

daleyjem commented Oct 5, 2024

Ok. I see what you're talking about. One caveat of a reusable workflow is that the context provided by Github/Octokit is inherited from the parent workflow. It doesn't show as workflow_call... which would allow me to make more automatic assumptions.

You pretty much said what is needed to make it work. Set your job_name input to <main workflow job> / <reusable workflow job>.

Unless you have a better proposal, I may opt to just adding documentation of how to use the action when inside of a workflow_call.

@daleyjem daleyjem added awaiting feedback and removed bug Something isn't working help wanted Extra attention is needed question Further information is requested labels Oct 5, 2024
@qoomon
Copy link
Author

qoomon commented Oct 7, 2024

@qoomon
Copy link
Author

qoomon commented Oct 7, 2024

Also see my PR to fix this problem in the github action runner actions/runner#3489

@jeremy-daley-kr
Copy link

Also see my PR to fix this problem in the github action runner actions/runner#3489

Can you give me the TL;DR? I'm still not sure what your actual recommendation is. Is this system.jobDisplayName available in the context object or elsewhere?

If it's easier to submit a PR here, or paste a code snippet in the context of this repo, I can certainly look at it.

@c3charvat
Copy link

@jeremy-daley-kr actions/runner#3489 is the PR.
I have been involved with tangentially with @qoomon a bit on this. @qoomon Correct me if i am wrong.
TL;DR: We are trying to resolve job URLs for a given job in a reusable workflow. There is nothing to match to in the job api (https://docs.github.com/en/rest/actions/workflow-jobs?apiVersion=2022-11-28#get-a-job-for-a-workflow-run) that readily available in the environment.

Not Short, sadly too long full detail version:
We are trying to resolve job URLs for a given job in a reusable workflow/matrix.
Since we don't have the FULL job name readily available to us in we have to do something like:
https://github.com/qoomon/actions--context/blob/402df64fd4c405e739f0e60e9ed0987c56013605/lib/actions.ts#L203-L227
to build the absolute job name.
Then search for it in the API context..

Up to this point it seems like a quality of life issue not necessarily a bug... But...

Since the system.jobId contains a GUID that is not present in job api endpoint, the only unique identifier is the JOB name.
(and MAYBE the runner name if status == in progress )

The issue becomes apparent when you apply a matrix or reusable workflow:
Note the code that handles job length....
So even while we can compile the full absolute job name the api truncates it... ie:
"build-with-reusable-workflow-with-matrix-inputs (1.1, In_this_input_we_are_testing_very_very_very... / build"
from:
API: https://api.github.com/repos/c3charvat/actions--context/actions/runs/11445449487/jobs
JOB URL: https://github.com/c3charvat/actions--context/actions/runs/11445449487/job/31842529999
Job # 2 Job actions/runner#3 which are unique but truncated to not be unique.

(Since the is the only guaranteed data shared between the job level api and the github.job context)
You cant really guarantee that you can resolve a individual jobs url.

Something similar was added for the Telemetry.
actions/runner@3d34a3c#diff-4085092f16aac893358021b20c7a92b02a504a1a99830bc88454ae0380638c45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants