Skip to content

Commit

Permalink
Add: [checkout-pull-request] action to checkout all commits of a sing…
Browse files Browse the repository at this point in the history
…le Pull Request (#26)
  • Loading branch information
TrueBrain committed May 20, 2021
1 parent ae4e62c commit 50599fe
Show file tree
Hide file tree
Showing 9 changed files with 1,837 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -9,6 +9,7 @@ As GitHub Actions doesn't allow to include workflows of other projects, this is

- [checkout](checkout/): Checkout tags and submodules; complements `actions/checkout`.
- [checkout-dispatch](checkout-dispatch/): Checkout from `remote_dispatch` with `publish_latest_tag`.
- [checkout-pull-request](checkout-pull-request/): Checkout all commits of a Pull Request.
- [deploy-aws](deploy-aws/): Deploy new Docker image to AWS.
- [deployments-create](deployments-create/): Create GitHub Deployments.
- [deployments-update](deployments-update/): Update GitHub Deployments status.
Expand Down
21 changes: 21 additions & 0 deletions checkout-pull-request/README.md
@@ -0,0 +1,21 @@
# OpenTTD - Checkout all commits of a Pull Request

The default `actions/checkout` only checks out the merge commit of a
Pull Request. This means that on `HEAD` is the merge commit, on `HEAD^` is the
base branch, and on `HEAD^2` are the commits of the Pull Request. Sometimes we
need all the commits of the Pull Request available to us, but the default
fetch-depth only give these three commits.

This action tries in a smart way to fetch the full history of a Pull Request,
by fetching more and more commits till `HEAD^` and `HEAD^2` have a common parent.
The log between those are all the commits the Pull Request introduce.

## Usage

First make sure to use `actions/checkout` to get the repository. Use a
`fetch-depth` of 4.
This action should be called directly after that.

```yaml
- uses: openttd/actions/checkout-pull-request@v2
```
7 changes: 7 additions & 0 deletions checkout-pull-request/action.yml
@@ -0,0 +1,7 @@
name: 'OpenTTD - Checkout Pull Request'
description: 'Checkout action to get the full history of a Pull Request'
author: 'OpenTTD'
inputs: {}
runs:
using: 'node12'
main: 'dist/index.js'

0 comments on commit 50599fe

Please sign in to comment.