-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Use the job_id
to set an environment variable
#139
Comments
@thboop - can you take a look? Doesn't look like a toolkit issue but perhaps you can answer quickly. |
Hey @1138-4eb thanks for the feedback! This page lists the values available in the context, the job context currently does not contain an Id field.
Are there any other fields on any of the contexts that would enable you to build better workflows? I'll make sure to capture those in our feedback ticket as well! As a side note, you may also want to consider starting a discussion on our community page for this item. |
Thank you for stepping by, and my apologies for taking long to reply...
You are correct. This issue is a feature request. The syntax above is just an example among the multiple tests I did before opening this issue. I wrote it because I think it is an 'intuitive' syntax.
Let's take the following example (https://github.com/1138-4EB/actions/commit/de2fddd87001ea5fa7227c03320d89834598fbe8/checks): name: 'push'
on: [pull_request, push]
jobs:
run:
strategy:
fail-fast: false
max-parallel: 2
matrix:
arch: [ amd64, arm, aarch64 ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- env:
GITHUB_CONTEXT: ${{ toJson(github) }}
STRATEGY_CONTEXT: ${{ toJson(strategy) }}
MATRIX_CONTEXT: ${{ toJson(matrix) }}
JOB_CONTEXT: ${{ toJson(job) }}
RUNNER_CONTEXT: ${{ toJson(runner) }}
STEPS_CONTEXT: ${{ toJson(steps) }}
run: |
printf "%s\n" \
"GITHUB_CONTEXT: $GITHUB_CONTEXT" \
"STRATEGY_CONTEXT: $STRATEGY_CONTEXT" \
"MATRIX_CONTEXT: $MATRIX_CONTEXT" \
"JOB_CONTEXT: $JOB_CONTEXT" \
"RUNNER_CONTEXT: $RUNNER_CONTEXT" \
"STEPS_CONTEXT: $STEPS_CONTEXT"
- run: yarn
Thoughts:
|
The contexts are rational is mostly around being able to reference them in yaml conditions and data values. They are separate because things like the github context and event payload are opaque (new events, data can be added) and about the event which are independent to the actions job and step context which is more about the graph execution. It's covered here: I'm going to close as this is not so much about the toolkit. It's more about the language design and the contexts. As pointed about above, feel free to open service discussions on the github community site: https://git.luolix.topmunity FYI @chrispat |
Precisely, my previous message was a direct reply to @thboop asking for specific feedback. I'm already redirecting my questions to the community site. |
This still doesn't seem to work. It makes it difficult to write re-usable code when there aren't these kind of variables available |
I'm trying to use the
job_id
to set an environment variable. For example:However, it is not working. Overall, I feel that contexts derived from the workflow have very little info, too little to be really useful. This is not the case with event sources.
The text was updated successfully, but these errors were encountered: