Skip to content
This repository was archived by the owner on May 3, 2026. It is now read-only.

Latest commit

 

History

5 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git-checkout-pull-request-action

GitHub Action to assure code is checked out from pull requests

A GitHub action has access to the git repository. But when an action is triggered on pull_request and said pull request is coming from a fork, the pull request base is checked out, not its head. This action assures that the code is checked out correctly, no matter if the pull request comes from a fork or not.

Example workflow

This workflow shows how to run npm test on pull requests

workflow "Test" {
  on = "pull_request"
  resolves = ["npm test"]
}

action "checkout pull request" {
  uses = "gr2m/git-checkout-pull-request-action@master"
  secrets = ["GITHUB_TOKEN"] # Token needed for private repositories only
}

action "npm ci" {
  needs = "checkout pull request"
  uses = "docker://node:alpine"
  runs = "npm"
  args = "ci"
}

action "npm test" {
  needs = "npm ci"
  uses = "docker://node:alpine"
  runs = "npm"
  args = "test"
}

License

MIT

About

GitHub Action to assure code is checked out from pull requests

Resources

Code of conduct

Contributing

Stars

2 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages