Skip to content

Commit 36a514b

Browse files
committed
get-installation-access-token: return a struct, not just the token
We recently ran into an expiring installation access token. To remedy that, we will want to return not only the token but also its expiry date. Prepare for that. Signed-off-by: Johannes Schindelin <[email protected]>
1 parent 2e4429f commit 36a514b

File tree

3 files changed

+5
-3
lines changed

3 files changed

+5
-3
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ jobs:
6666
)
6767
6868
const getInstallationAccessToken = require('./get-installation-access-token')
69-
const accessToken = await getInstallationAccessToken(
69+
const { token: accessToken } = await getInstallationAccessToken(
7070
console,
7171
appId,
7272
privateKey,

.github/workflows/create-azure-self-hosted-runners.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ jobs:
8080
)
8181
8282
const getInstallationAccessToken = require('./get-installation-access-token')
83-
const accessToken = await getInstallationAccessToken(
83+
const { token: accessToken } = await getInstallationAccessToken(
8484
console,
8585
appId,
8686
privateKey,

get-installation-access-token.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ module.exports = async (context, appId, privateKey, installation_id) => {
77
'POST',
88
`/app/installations/${installation_id}/access_tokens`)
99
if (answer.error) throw answer.error
10-
if (answer.token) return answer.token
10+
if (answer.token) return {
11+
token: answer.token
12+
}
1113
throw new Error(`Unhandled response:\n${JSON.stringify(answer, null, 2)}`)
1214
}

0 commit comments

Comments
 (0)