Pass a GITHUB_TOKEN from Github actions to AWS Codebuild, in order to update checks from there #101890
-
Select Topic AreaQuestion BodyI'm trying to integrate github actions and codebuild as automatically as possible. We're using OIDC to trigger codebuild and push code to an s3 bucket. Codebuild runs and executes tests, as expected, but when using the GITHUB_TOKEN provided by the action to update our check, we get an error:
the command we're running is this:
I added this to the action yaml:
is it possible to use these tokens outside of github actions? should I use a github app for this purpose? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 1 reply
This comment was marked as off-topic.
This comment was marked as off-topic.
-
Hi @atirabassi-eb how did you manage to solve it? I am having |
Beta Was this translation helpful? Give feedback.
Integrating GitHub Actions with AWS CodeBuild and attempting to use the GITHUB_TOKEN outside of GitHub Actions is a common challenge. The GITHUB_TOKEN is a short-lived token generated by GitHub Actions and is intended for use within the context of GitHub Actions workflows only. This is likely the reason you're encountering the "Bad credentials" error. The token loses its validity when used outside the Actions environment.
Here’s how you can address this issue: