GITHUB_TOKEN not present in script set as ACTIONS_RUNNER_HOOK_JOB_STARTED
Describe the bug
The env var GITHUB_TOKEN is not present in the context of the script set as ACTIONS_RUNNER_HOOK_JOB_STARTED.
Not sure if this has some security concern, but we would need a valid GITHUB_TOKEN during our pre-job script.
To Reproduce Steps to reproduce the behavior:
- Create a simple bash script that run the command
envand set its path as env var forACTIONS_RUNNER_HOOK_JOB_STARTED - Trigger the workflow
- See there is no GITHUB_TOKEN available.
Expected behavior
The env var GITHUB_TOKEN should be present in the context of the script set as ACTIONS_RUNNER_HOOK_JOB_STARTED.
Runner Version and Platform
Version of your runner? 2.308.0
OS of the machine running the runner? Linux Debian 11, Kubernetes (GKE) using actions-runner-controller.
Thanks
We also struggle with same problem...
Hey guys, any update on this? Thanks
Hello,
Any chance this change might be implemented soon ?
Thanks in advance for your feedback Éric
Any news about this?
@mirobertod @AmorfEvo @EricDales @MiticoBerna could you help us understand more about your scenario. Especially interested in scenarios involving organization-level or enterprise-level runners.
Hi @ericsciple, thank you for your interest.
We want to prevent unauthorized modifications of the CI yaml files under .github folder.
Our goal is to download the repository using the token to verify if, for example, a signature we placed at the top of the CI YAML file has been altered by someone else.
If you have a better approach to ensure that the CI configuration can be modified only from authorized people, let us know.
Hi @ericsciple for our use-case we're looking to use the token to call the /actions/runs/{run_id}/jobs endpoint during a ACTIONS_RUNNER_HOOK_JOB_COMPLETED hook. This would let us collect metrics/traces about the job's execution (duration of individual steps, statistics about failure rates, etc). All of our runners are organization-level, so this would give us a lot of observability data.
In a roundabout way, I'm trying to retrieve this information via api due to the limitations mentioned in https://github.com/orgs/community/discussions/8945