Answers: <p>I haven't seen this, since the GHA only has the person who triggered and commits <a href="https://docs.github.com/en/actions/learn-github-actions/contexts" rel="nofollow noreferrer">context available</a>.</p>
  <p>For testing, it's better to have a user assigned to this purposes and then store its secrets in the repo/org level. Although if the REST API is the project itself, setting up the project (API), creating the test user (with pre-defined secrets) and testing with it should be part of the pipeline as possible.</p>
  <p>As a last resource (wouldn't recommend, reconsider strategy), I'd go ahead and  use a separate vault for secrets (like <a href="https://www.hashicorp.com/products/vault" rel="nofollow noreferrer">Hashicorp Vault</a>), login with project credentials and based on an input or action actor, fetch per-user secrets.</p>
  
Answers: CC BY-SA 4.0
Answers: 2023-05-15T15:39:05.777Z
Answers: 2023-05-15T15:39:05.777Z
Answers: Alberto Castillo G
Body: <p>I would like to create a GitHub workflow for running tests against a REST API. The API needs a key that is always tied to a user, there is no global &quot;testing&quot; key.</p>
  <p>Is there a way for each contributor to store their API key in a way that GitHub Actions can access it? I understand there is GitHub Secrets, but these are at best defined at a repo-level. I have also seen that this option exists for Codespaces, but my organization is not using those.</p>
  
Tags: <continuous-integration><github><testing><github-actions>
Title: User-level secrets in GitHub Actions
UserDisplayName: Parzival
ThreadText: # User-level secrets in GitHub Actions
  
  (Asked by: username_0 on 2023-05-14)
  
  I would like to create a GitHub workflow for running tests against a REST API. The API needs a key that is always tied to a user, there is no global "testing" key.
  
  Is there a way for each contributor to store their API key in a way that GitHub Actions can access it? I understand there is GitHub Secrets, but these are at best defined at a repo-level. I have also seen that this option exists for Codespaces, but my organization is not using those.
  
  **Tags:** continuous-integration, github, testing, github-actions
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-05-15. Score: 1
  
  I haven't seen this, since the GHA only has the person who triggered and commits [context available](https://docs.github.com/en/actions/learn-github-actions/contexts).
  
  For testing, it's better to have a user assigned to this purposes and then store its secrets in the repo/org level. Although if the REST API is the project itself, setting up the project (API), creating the test user (with pre-defined secrets) and testing with it should be part of the pipeline as possible.
  
  As a last resource (wouldn't recommend, reconsider strategy), I'd go ahead and use a separate vault for secrets (like [Hashicorp Vault](https://www.hashicorp.com/products/vault)), login with project credentials and based on an input or action actor, fetch per-user secrets.
  
  
  ---
  
  