feat: add input for short description

This commit is contained in:
Peter Evans
2020-09-25 15:22:36 +09:00
parent 9db4dd4244
commit 8fa8201677
6 changed files with 28 additions and 4 deletions

View File

@@ -1,6 +1,8 @@
import * as core from '@actions/core'
import * as fetch from 'node-fetch'
const DESCRIPTION_MAX_CHARS = 100
export async function getToken(
username: string,
password: string
@@ -22,11 +24,15 @@ export async function getToken(
export async function updateRepositoryDescription(
token: string,
repository: string,
description: string,
fullDescription: string
): Promise<void> {
const body = {
full_description: fullDescription
}
if (description) {
body['description'] = description.slice(0, DESCRIPTION_MAX_CHARS)
}
await fetch(`https://hub.docker.com/v2/repositories/${repository}`, {
method: 'patch',
body: JSON.stringify(body),