-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
73 lines (61 loc) · 2.17 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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: 'Get a GitHub token'
description: 'Get a GitHub token. If `token` is passed, it will be used. Otherwise, an app token will be generated.'
inputs:
token:
description: 'GitHub token to use. If passed, takes precedence over the `app-id` and `app-private-key` inputs.'
app-id:
description: 'The app ID of the app.'
private-key:
description: 'The private key of the app.'
owner:
description: 'The owner of the GitHub App installation (defaults to current repository owner)'
required: false
repositories:
description: 'Repositories to install the GitHub App on (defaults to current repository if owner is unset)'
required: false
skip-token-revoke:
description: 'If truthy, the token will not be revoked when the current job is complete'
required: false
github-api-url:
description: 'The URL of the GitHub REST API.'
default: ${{ github.api_url }}
outputs:
token:
description: 'The GitHub token.'
value: ${{ steps.token.outputs.token || steps.app.outputs.token }}
runs:
using: composite
steps:
- name: 'Log'
id: log
shell: bash
#language=bash
run: |
if [ -n "${{ inputs.github-token }}" ]; then
echo "Using GitHub token."
elif [ -n "${{ inputs.app-id }}" ] && [ -n "${{ inputs.private-key }}" ]; then
echo "Using app credentials."
fi
- id: app
if: inputs.token == '' && (inputs.app-id != '' || inputs.private-key != '')
uses: myparcelnl/actions/setup-app-credentials@v4
with:
app-id: ${{ inputs.app-id }}
private-key: ${{ inputs.private-key }}
owner: ${{ inputs.owner }}
repositories: ${{ inputs.repositories }}
skip-token-revoke: ${{ inputs.skip-token-revoke }}
github-api-url: ${{ inputs.github-api-url }}
- id: token
if: inputs.token != ''
shell: bash
#language=bash
run: |
echo "token=${{ inputs.token }}" >> $GITHUB_OUTPUT
- id: error
if: inputs.token == '' && (inputs.app-id == '' || inputs.private-key == '')
shell: bash
#language=bash
run: |
echo "::error::No GitHub token or app credentials provided."
exit 1