-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
55 lines (53 loc) · 1.64 KB
/
action.yml
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
name: 'create-release-action'
description: 'A reusable template for creating a GitHub Action using TypeScript.'
author: 'Invitation Homes'
inputs:
github-token:
required: true
description: 'The GitHub token to use'
name:
required: true
description: 'The name of the release'
tag-name:
required: true
description: 'The name of the tag'
draft:
description: 'Whether or not to create a draft release'
type: boolean
default: false
pre-release:
description: 'Whether or not the release should be marked as a pre-release'
type: boolean
default: false
generate-release-notes:
description: 'Whether to automatically generate the name and body for this release'
type: boolean
default: false
outputs:
release-id:
description: "ID of the GitHub release"
value: ${{ steps.create-release.outputs.result }}
runs:
using: 'composite'
steps:
- name: Create GitHub release
id: create-release
uses: actions/github-script@v6
with:
github-token: ${{ inputs.github-token }}
result-encoding: string
script: |
try {
const response = await github.rest.repos.createRelease({
name: "${{ inputs.name }}",
tag_name: "${{ inputs.tag-name }}",
draft: ${{ inputs.draft }},
generate_release_notes: ${{ inputs.generate-release-notes }},
owner: context.repo.owner,
prerelease: ${{ inputs.pre-release }},
repo: context.repo.repo,
});
return response.data.id;
} catch (error) {
core.setFailed(error.message);
}