forked from 8BitJonny/gh-get-current-pr
-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.yaml
112 lines (94 loc) · 3.04 KB
/
README.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# Name of this project
name: Get PR
# Tags of this project
tags:
- github-action
# License of this project
license: "GPL-3.0"
# Canonical GitHub repo
github_repo: cloudposse-github-actions/get-pr
# Badges to display
badges:
- name: "Latest Release"
image: "https://img.shields.io/github/release/cloudposse-github-actions/get-pr.svg"
url: "https://github.com/cloudposse-github-actions/get-pr/releases/latest"
- name: "Slack Community"
image: "https://slack.cloudposse.com/badge.svg"
url: "https://slack.cloudposse.com"
related: []
# Short description of this project
description: |
Get the PR info associated with the commit.
author: [email protected]
introduction: |-
Fork of [8BitJonny/gh-get-current-pr](https://github.com/8BitJonny/gh-get-current-pr) adopted to Cloud Posse's GitHub Actions standards.
references: []
# How to use this project
usage: |-
This action will retrieve the PR metadata by `id` (PR number) or commit `sha`.
The `id` takes precedence over `sha`, if both are passed.
### By ID
```yaml
on:
pull_request:
branches:
- main
types: [opened, synchronize, reopened]
jobs:
pr:
name: PR Info
runs-on: ubuntu-latest
steps:
- uses: cloudposse-github-actions/get-pr@main
id: pr
with:
id: ${{ github.event.number }}
outputs:
base: ${{ fromJSON(steps.pr.outputs.pr).base.sha }}
head: ${{ fromJSON(steps.pr.outputs.pr).head.sha }}
found: ${{ steps.pr.outputs.found }}
json: ${{ steps.pr.outputs.json }}
number: ${{ steps.pr.outputs.number }}
title: ${{ steps.pr.outputs.title }}
body: ${{ steps.pr.outputs.body }}
url: ${{ steps.pr.outputs.url }}
created_at: ${{ steps.pr.outputs.created_at }}
merged_at: ${{ steps.pr.outputs.merged_at }}
closed_at: ${{ steps.pr.outputs.closed_at }}
labels: ${{ steps.pr.outputs.labels }}
```
### By SHA
```yaml
on:
push:
branches:
- main
jobs:
pr:
name: PR Info
runs-on: ubuntu-latest
steps:
- uses: cloudposse-github-actions/get-pr@main
id: pr
outputs:
base: ${{ fromJSON(steps.pr.outputs.pr).base.sha }}
head: ${{ fromJSON(steps.pr.outputs.pr).head.sha }}
found: ${{ steps.pr.outputs.found }}
json: ${{ steps.pr.outputs.json }}
number: ${{ steps.pr.outputs.number }}
title: ${{ steps.pr.outputs.title }}
body: ${{ steps.pr.outputs.body }}
url: ${{ steps.pr.outputs.url }}
created_at: ${{ steps.pr.outputs.created_at }}
merged_at: ${{ steps.pr.outputs.merged_at }}
closed_at: ${{ steps.pr.outputs.closed_at }}
labels: ${{ steps.pr.outputs.labels }}
```
include:
- "docs/github-action.md"
# Contributors to this project
contributors:
- name: "Timon Christiansen"
github: "8BitJonny"
- name: "Igor Rodionov"
github: "goruha"