Skip to content

Commit c74de88

Browse files
committed
add app auth
1 parent 21dc310 commit c74de88

File tree

9 files changed

+14570
-11015
lines changed

9 files changed

+14570
-11015
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,12 @@ Refer [here](https://github.com/actions/checkout/blob/v1/README.md) for previous
105105
#
106106
# Default: false
107107
submodules: ''
108+
109+
# GitHub app id
110+
app-id: ''
111+
112+
# GitHub app private key
113+
app-private-key: ''
108114
```
109115
<!-- end usage -->
110116

__test__/input-helper.test.ts

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ describe('input-helper tests', () => {
6767
jest.restoreAllMocks()
6868
})
6969

70-
it('sets defaults', () => {
71-
const settings: IGitSourceSettings = inputHelper.getInputs()
70+
it('sets defaults', async () => {
71+
const settings: IGitSourceSettings = await inputHelper.getInputs()
7272
expect(settings).toBeTruthy()
7373
expect(settings.authToken).toBeFalsy()
7474
expect(settings.clean).toBe(true)
@@ -82,11 +82,11 @@ describe('input-helper tests', () => {
8282
expect(settings.repositoryPath).toBe(gitHubWorkspace)
8383
})
8484

85-
it('qualifies ref', () => {
85+
it('qualifies ref', async () => {
8686
let originalRef = github.context.ref
8787
try {
8888
github.context.ref = 'some-unqualified-ref'
89-
const settings: IGitSourceSettings = inputHelper.getInputs()
89+
const settings: IGitSourceSettings = await inputHelper.getInputs()
9090
expect(settings).toBeTruthy()
9191
expect(settings.commit).toBe('1234567890123456789012345678901234567890')
9292
expect(settings.ref).toBe('refs/heads/some-unqualified-ref')
@@ -97,29 +97,30 @@ describe('input-helper tests', () => {
9797

9898
it('requires qualified repo', () => {
9999
inputs.repository = 'some-unqualified-repo'
100-
assert.throws(() => {
101-
inputHelper.getInputs()
102-
}, /Invalid repository 'some-unqualified-repo'/)
100+
assert.rejects(
101+
() => inputHelper.getInputs(),
102+
/Invalid repository 'some-unqualified-repo'/
103+
)
103104
})
104105

105-
it('roots path', () => {
106+
it('roots path', async () => {
106107
inputs.path = 'some-directory/some-subdirectory'
107-
const settings: IGitSourceSettings = inputHelper.getInputs()
108+
const settings: IGitSourceSettings = await inputHelper.getInputs()
108109
expect(settings.repositoryPath).toBe(
109110
path.join(gitHubWorkspace, 'some-directory', 'some-subdirectory')
110111
)
111112
})
112113

113-
it('sets ref to empty when explicit sha', () => {
114+
it('sets ref to empty when explicit sha', async () => {
114115
inputs.ref = '1111111111222222222233333333334444444444'
115-
const settings: IGitSourceSettings = inputHelper.getInputs()
116+
const settings: IGitSourceSettings = await inputHelper.getInputs()
116117
expect(settings.ref).toBeFalsy()
117118
expect(settings.commit).toBe('1111111111222222222233333333334444444444')
118119
})
119120

120-
it('sets sha to empty when explicit ref', () => {
121+
it('sets sha to empty when explicit ref', async () => {
121122
inputs.ref = 'refs/heads/some-other-ref'
122-
const settings: IGitSourceSettings = inputHelper.getInputs()
123+
const settings: IGitSourceSettings = await inputHelper.getInputs()
123124
expect(settings.ref).toBe('refs/heads/some-other-ref')
124125
expect(settings.commit).toBeFalsy()
125126
})

action.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ inputs:
6868
When the `ssh-key` input is not provided, SSH URLs beginning with `git@github.com:` are
6969
converted to HTTPS.
7070
default: false
71+
app-id:
72+
description: GitHub app id
73+
optional: true
74+
app-private-key:
75+
description: GitHub app private key
76+
optional: true
7177
runs:
7278
using: node12
7379
main: dist/index.js

0 commit comments

Comments
 (0)