Skip to content

Commit ba7d9e7

Browse files
committed
chore: update README.md
1 parent 04aa142 commit ba7d9e7

File tree

2 files changed

+39
-0
lines changed

2 files changed

+39
-0
lines changed

.github/banner.png

383 Bytes
Loading

README.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,44 @@ Fork of [8BitJonny/gh-get-current-pr](https://github.com/8BitJonny/gh-get-curren
5959
6060

6161

62+
This action will retrieve the PR metadata by `id` (PR number) or commit `sha`.
63+
The `id` takes precedence over `sha`, if both are passed.
64+
65+
### By ID
66+
67+
```yaml
68+
on:
69+
pull_request:
70+
branches:
71+
- main
72+
types: [opened, synchronize, reopened]
73+
74+
jobs:
75+
pr:
76+
name: PR Info
77+
runs-on: ubuntu-latest
78+
steps:
79+
- uses: cloudposse-github-actions/get-pr@main
80+
id: pr
81+
with:
82+
id: ${{ github.event.number }}
83+
outputs:
84+
base: ${{ fromJSON(steps.pr.outputs.pr).base.sha }}
85+
head: ${{ fromJSON(steps.pr.outputs.pr).head.sha }}
86+
found: ${{ steps.pr.outputs.found }}
87+
json: ${{ steps.pr.outputs.json }}
88+
number: ${{ steps.pr.outputs.number }}
89+
title: ${{ steps.pr.outputs.title }}
90+
body: ${{ steps.pr.outputs.body }}
91+
url: ${{ steps.pr.outputs.url }}
92+
created_at: ${{ steps.pr.outputs.created_at }}
93+
merged_at: ${{ steps.pr.outputs.merged_at }}
94+
closed_at: ${{ steps.pr.outputs.closed_at }}
95+
labels: ${{ steps.pr.outputs.labels }}
96+
```
97+
98+
### By SHA
99+
62100
```yaml
63101
on:
64102
push:
@@ -101,6 +139,7 @@ Fork of [8BitJonny/gh-get-current-pr](https://github.com/8BitJonny/gh-get-curren
101139
| filterOutClosed | True, False, 1 or 0 if only open PRs should be returned. Defaults to false. | N/A | false |
102140
| filterOutDraft | True, False, 1 or 0 if only non-draft PRs should be returned. Defaults to false. | N/A | false |
103141
| github-token | The GitHub token used to create an authenticated client. | ${{ github.token }} | false |
142+
| id | PR ID to get info for. | N/A | false |
104143
| sha | Sha to get PR for. Defaults to current sha. | N/A | false |
105144
106145

0 commit comments

Comments
 (0)