Comments (7)
Awesome. thanks @1138-4eb
Note that I also cc'd @chrispat above from lang product so he has context.
from toolkit.
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
from toolkit.
@thboop - can you take a look? Doesn't look like a toolkit issue but perhaps you can answer quickly.
from toolkit.
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.
Overall, I feel that contexts derived from the workflow have very little info, too little to be really useful.
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.
from toolkit.
Hey @1138-4eb thanks for the feedback!
Thank you for stepping by, and my apologies for taking long to reply...
This page lists the values available in the context, the job context currently does not contain an Id field.
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.
Overall, I feel that contexts derived from the workflow have very little info, too little to be really useful.
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!
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
STRATEGY_CONTEXT: {
"fail-fast": false,
"job-index": 0,
"job-total": 3,
"max-parallel": 2
}
MATRIX_CONTEXT: {
"arch": "amd64"
}
JOB_CONTEXT: {
"status": "Success"
}
RUNNER_CONTEXT: {
"os": "Linux",
"tool_cache": "/opt/hostedtoolcache",
"temp": "/home/runner/work/_temp",
"workspace": "/home/runner/work/actions"
}
STEPS_CONTEXT: {}
Thoughts:
- JOB_CONTEXT does not contain the name/id of the job, as defined in the YAML. In the example:
run
. This is the motivation of this issue. - GITHUB_CONTEXT is ~200 lines long. Does it make sense to have such a large object and then provide 5 different objects for no more than 15 lines/fields of info? I think it would be sensible to have a single ACTION_CONTEXT with fields
strategy
,matrix
,job
,runner
andsteps
. - I'd expect MATRIX_CONTEXT to contain all the options defined in the matrix AND those that apply to the job/step.
- By the same token, either MATRIX_CONTEXT or STRATEGY_CONTEXT should contain a list of all the jobs generated as a combination of matrix fields. Currently only the number,
job-total
, is provided.
- By the same token, either MATRIX_CONTEXT or STRATEGY_CONTEXT should contain a list of all the jobs generated as a combination of matrix fields. Currently only the number,
runs-on
is not available in any context. It would be handy to identify which of the available environments is being used.STEPS_CONTEXT
does not contain any actual info:name
,shell
,run
,env
... fields.uses
,with
... fields.if
fields (probably with resolved variable).status
fields.
- Neither JOB_CONTEXT nor STEPS_CONTEXT contain any info about the number of steps (e.g.
steps-total
). - When using
actions/checkout@v1
, the path where the repo is cloned is only specified with GITHUB_CONTEXT. It is{{ runner.workspace }} + {{ github.event.repository.name }}
or{{ github.workspace }}
.
from toolkit.
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:
https://help.github.com/en/articles/contexts-and-expression-syntax-for-github-actions
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://github.community
FYI @chrispat
from toolkit.
I'm going to close as this is not so much about the toolkit. It's more about the language design and the contexts.
Precisely, my previous message was a direct reply to @thboop asking for specific feedback. I'm already redirecting my questions to the community site.
from toolkit.
Related Issues (20)
- Toolcache extracted with wrong modification timestamps
- Cache upload does not handle 429 error HOT 2
- https://youtube.com/@MrBeast?si=f04Nnt9Du9p4eNR4
- The default export of @actions/[email protected] is incorrect HOT 5
- Tool Catching
- Alternative to uploading to the same named Artifact multiple times HOT 1
- `@actions/artifact` dependency `crypto` is deprecated HOT 2
- Non-zero `exitCode` is not accessible from `exec`/`getExecOutput` with `ignoreReturnCode: false`
- getArtifact function using deprecated (due to security and usability issues) buffer function HOT 1
- Regression in @actions/http-client 2.2.0 since 2.1.1: Bundle size increased by 820kB
- getInput empty returned value
- exec should not fail if provided a command with a missing tool when using {ignoreReturnCode: true, failOnStdErr:false}
- platform is undefined HOT 1
- cache.saveCache should raise an error on reserve failure, but doesn't HOT 1
- @actions/ccache causing 2min slowdown with Node 20 runtime
- actions/exec: Allow to kill the child process
- No Git tag created for `@actions/[email protected]`
- Introduce GITHUB_PROXY environment variable support in http-client
- core.addPath() can break $PATH in the openSUSE container HOT 1
- Access runner.name
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from toolkit.