Replies: 23 comments 31 replies
-
Thanks for the feedback. We should add this, indeed. I'll talk to the team about this in the new year. |
Beta Was this translation helpful? Give feedback.
-
Do you happen to have any news on this topic? |
Beta Was this translation helpful? Give feedback.
-
This would be a very good to have feature. When there is an existing action that uses the GitHub API, you know there is a need for it. Having it in the context, and especially as an environment variable (so that automation can use it too, without having to pass it as a jinja template variable), would be a godsend! 🙏🏻 |
Beta Was this translation helpful? Give feedback.
-
Chiming in from 2023, we really need this. The job I am trying to get the ID for is a matrix job with a stringified JSON object as its value so the name is truncated making the workaround practically useless. |
Beta Was this translation helpful? Give feedback.
-
I'm embarrassed to share this, but I know people are struggling. Here is how I'm getting this to work in every scenario:
if len(provided_job_name) > 100:
possible_job_names.append( provided_job_name[:97] + "..." )
I know this is not pretty but it has been very effective. I really hope Github don't see this as a workaround which delays implementing the fix. If I see that happening I may have to delete this post. I should also add the customary reminder that you shouldn't risk your career or your user's happiness based on a snippet of code you saw someone post on the Internet. |
Beta Was this translation helpful? Give feedback.
-
Our use case for requiring a job Id is as follows: We have software that runs against dozens of different npm packages. Each package run is done in a separate job. If this software fails then we send a Slack message to the team to look at the incompatible npm package. Ideally we would be able to provide a URL in this slack message so that a developer can click it for more information:
|
Beta Was this translation helpful? Give feedback.
-
No it is not: this is the string key of the job, as in jobs:
my_first_job:
name: My first job
my_second_job:
name: My second job |
Beta Was this translation helpful? Give feedback.
-
We could really use the jobid in the github context so on a matrix job so we can provide a html_url to a workflow status dashboard... |
Beta Was this translation helpful? Give feedback.
-
So, it's one of the plenty cases, where GH actions aren't fixing their fundamental issues. Just an example of how we solve it in python https://github.com/ClickHouse/clickhouse/blob/4b7aa30/tests/ci/env_helper.py#L49-L95 The code tries to address either the feature requested in this discussion or in the issue actions/runner#2577 |
Beta Was this translation helpful? Give feedback.
-
We are experimenting with reusable workflows, and it's just the last border before the deepest inconsistency hell. The logs are So, the In Felixoid/actions-experiments@8eaa77a I tried to override the parameter - no luck. update: in tests + concurrency_call (logs_39.zip) I tried to get this variable from at least any place. No luck, neither of the contexts github, runner, env, nor job contains this value. So, the outcome: without kicking around with strange self-invented variables, GH actions not only prevent you from finding an easy way to get the job_id, but any tool you have out of the box will ultimately give a broken solution. Because who needs to know the full Job name, right? |
Beta Was this translation helpful? Give feedback.
-
It's almost 2024 and still no movement on this? It's seems to be impossible to tie a current run to a previous run unless either the |
Beta Was this translation helpful? Give feedback.
-
It's now 2024 and GitHub is still adding job ID in context. We need a way to distinguish one job from another, especially when using matrix. This should not be a difficult thing either, the job ID is already in the URL. |
Beta Was this translation helpful? Give feedback.
-
The impact of this is ultimately an inability to link to logs from a test reporting system. This is critical for our evals setup where debuggable events within the job need to link back to the full job for logs, so I think this could mean we have to switch away from GitHub Actions. |
Beta Was this translation helpful? Give feedback.
-
I said to hell with it and just started using random IDs as suffixes to get around duplicate artifact names. I would have just liked to use the job id for the workflow_call so I can at least trace an artifact back to the job that generated it. Greatly simplified, but this guy runs into trouble when trying to upload artifacts from workflow_call invocations where it's called multiple times in a matrix (or just used multiple times at all) name: Storybook
on:
workflow_dispatch:
workflow_call:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
# ////////////////////////////////////////////////////////////////////////
# Setup tasks
# ////////////////////////////////////////////////////////////////////////
# ////////////////////////////////////////////////////////////////////////
# Run tests
# ////////////////////////////////////////////////////////////////////////
# ////////////////////////////////////////////////////////////////////////
# Upload test artifacts
# ////////////////////////////////////////////////////////////////////////
- name: Generate a unique id
id: gen-id
if: always()
run: |
echo "rand=$(openssl rand -hex 3)" >> "$GITHUB_OUTPUT"
- name: archive storybook junit
uses: actions/upload-artifact@v4
if: always()
with:
name: storybook-junit-${{ github.run_id }}-${{ steps.gen-id.outputs.rand }}
path: junit.xml
retention-days: 7
- name: archive storybook json
uses: actions/upload-artifact@v4
if: always()
with:
name: storybook-json-${{ github.run_id }}-${{ steps.gen-id.outputs.rand }}
path: storybook-run.json
retention-days: 7 |
Beta Was this translation helpful? Give feedback.
-
2 years and a half and this is still a HUGE gap on GitHub API. It makes a lot of possible integrations and useful actions very hard to be implemented. |
Beta Was this translation helpful? Give feedback.
-
Job IDs are necessary when running in a matrix to accurately link specific tasks. Additionally, the recently-released version 4 of |
Beta Was this translation helpful? Give feedback.
-
I also need it in Argos to support granular retries. In case of matrix builds (Playwright sharding for example) I have no way to know which shard is linked to which job. So I have no way to actually know in Argos how many shards are awaited for this retry attempt. The lack of unique identifier of a job across retry attempts (except the name not exposed), is a big problem actually. |
Beta Was this translation helpful? Give feedback.
-
Just adding our use case and to the chorus of voices here. We are trying to upload some artifacts from a matrix of jobs just like another person explained above. However, we also want to know which specific job each artifact came from. Without the job ID available to the runner at artifact generation + upload time within the job, I'm not sure how we can not only have non-conflicting artifact names, but also know which jobs generated them. The current solution I've been thinking about was to use the idea from above with some UUID generation and pray there's no collision for artifact names. But that still doesn't solve the problem of knowing which job made them. For that, I was thinking of printing out a parsable string for the UUID I mentioned within the logs of the job and then searching for it by download the logs for each job for a given workflow run. That solution is really cumbersome and still prone to error. This would all go so much smoother for us if we had the job ID available instead in a context. |
Beta Was this translation helpful? Give feedback.
-
name: Example Workflow on: [push] jobs:
second_job:
|
Beta Was this translation helpful? Give feedback.
-
Feel free to use my action to access current Example Workflow jobs:
example:
runs-on: ubuntu-latest
environment: playground
permissions:
actions: read # required for qoomon/actions--context action
deployments: read # required for qoomon/actions--context action
contents: read
steps:
- uses: qoomon/actions--context@v1
id: context
- run: |
echo "Current Environment: ${{ steps.context.outputs.environment }}"
echo "Current Environment: ${{ steps.context.outputs.job_id }}"
echo "Job Logs: ${{ steps.context.outputs.job_log_url }}" |
Beta Was this translation helpful? Give feedback.
-
Hey, sorry for being quiet here. Let me find out how hard adding this and the job_name would be. In the mean time I know that one of our solution engineers made an Action that gets the ID back at least Hold tight and let me see what this woudl take <3 |
Beta Was this translation helpful? Give feedback.
-
While poking around at the actions/runner repo I found this closed pull request which would partially implement it. It's not entirely clear why it was approved but then closed without merging. Though it seems like there's probably a missing piece to implement on the server side, since AgentJobRequestMessage's variables don't currently include |
Beta Was this translation helpful? Give feedback.
-
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
Beta Was this translation helpful? Give feedback.
-
Hi,
Right now, it seems that there is no way to identify the job that is being run from inside of the GitHub workflow run.
The
github
context only has the element job, with matches with the string id of the job.But when you try to get the job from the GitHub API, there is no way to match against it. If there is no
name
for this job, you could match them but it is not safe.I think you could add to the
github
orjob
context the id of the job run to be able to query the GitHub API about the current job.I found these community entries regarding this request, but I couldn't find a ticket or discussion regarding this issue:
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions