21 Commits

Author SHA1 Message Date
Peter Evans
93b93397c2 Merge pull request #79 from peter-evans/fix-tag-push
Some checks failed
Publish Docker Image / publish (push) Has been cancelled
fix: push all tags
2022-11-07 15:07:34 +09:00
Peter Evans
3103d1465d fix: push all tags 2022-11-07 15:06:08 +09:00
Peter Evans
0b9f9c4786 Merge pull request #76 from peter-evans/fix-any
fix: replace use of any type
2022-10-21 15:12:44 +09:00
Peter Evans
3b9f4f25f0 fix: replace use of any type 2022-10-21 15:10:59 +09:00
Peter Evans
1488116043 Merge pull request #75 from peter-evans/update-distribution
Some checks failed
Publish Docker Image / publish (push) Has been cancelled
Update distribution
2022-10-18 15:21:30 +09:00
peter-evans
4fd465609e build: update distribution 2022-10-18 06:21:05 +00:00
Peter Evans
9404f28f56 Merge pull request #74 from peter-evans/dependabot/npm_and_yarn/actions/core-1.10.0
build(deps): bump @actions/core from 1.9.1 to 1.10.0
2022-10-18 15:19:51 +09:00
dependabot[bot]
eef18f85b1 build(deps): bump @actions/core from 1.9.1 to 1.10.0
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.9.1 to 1.10.0.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-10-18 06:16:47 +00:00
Peter Evans
db792ed6c9 ci: update dependabot 2022-10-18 15:16:21 +09:00
Peter Evans
4fdf852815 docs: add funding 2022-08-26 10:41:06 +09:00
Peter Evans
bc97286b92 Merge pull request #73 from peter-evans/update-distribution
Update distribution
2022-08-19 11:59:20 +09:00
peter-evans
b2ff61bdb1 build: update distribution 2022-08-19 02:59:02 +00:00
Peter Evans
c908a72eaf Merge pull request #72 from peter-evans/dependabot/npm_and_yarn/actions/core-1.9.1
build(deps): bump @actions/core from 1.6.0 to 1.9.1
2022-08-19 11:57:49 +09:00
dependabot[bot]
2c9ccb12d6 build(deps): bump @actions/core from 1.6.0 to 1.9.1
Bumps [@actions/core](https://github.com/actions/toolkit/tree/HEAD/packages/core) from 1.6.0 to 1.9.1.
- [Release notes](https://github.com/actions/toolkit/releases)
- [Changelog](https://github.com/actions/toolkit/blob/main/packages/core/RELEASES.md)
- [Commits](https://github.com/actions/toolkit/commits/HEAD/packages/core)

---
updated-dependencies:
- dependency-name: "@actions/core"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-08-19 02:56:43 +00:00
Peter Evans
27a09e0234 ci: add workflow permissions 2022-08-19 11:53:46 +09:00
Peter Evans
da890086d3 Merge pull request #71 from peter-evans/rm-byte-limit
Some checks failed
Publish Docker Image / publish (push) Has been cancelled
feat: remove error when content limit exceeded
2022-08-18 12:20:07 +09:00
Peter Evans
afa309ec72 feat: remove error when content limit exceeded 2022-08-18 12:17:06 +09:00
Peter Evans
22ceabb390 docs: add pat scope details 2022-07-21 14:26:40 +09:00
Peter Evans
5edfa5bd9e docs: update to reflect access tokens can be used 2022-07-19 15:46:44 +09:00
Peter Evans
1cf9afbac3 Merge pull request #65 from peter-evans/dependabot/github_actions/peter-evans/create-pull-request-4 2022-03-29 00:31:00 +09:00
dependabot[bot]
8a5577cb53 build(deps): bump peter-evans/create-pull-request from 3 to 4
Bumps [peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request) from 3 to 4.
- [Release notes](https://github.com/peter-evans/create-pull-request/releases)
- [Commits](https://github.com/peter-evans/create-pull-request/compare/v3...v4)

---
updated-dependencies:
- dependency-name: peter-evans/create-pull-request
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-03-28 14:26:09 +00:00
10 changed files with 1546 additions and 379 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
github: peter-evans

View File

@@ -6,3 +6,10 @@ updates:
interval: "weekly"
labels:
- "dependencies"
- package-ecosystem: "npm"
directory: "/"
schedule:
interval: "weekly"
allow:
- dependency-name: "@actions/*"

View File

@@ -10,6 +10,11 @@ on:
paths-ignore:
- 'README.md'
- 'docs/**'
permissions:
pull-requests: write
contents: write
jobs:
build:
runs-on: ubuntu-latest
@@ -86,7 +91,7 @@ jobs:
name: dist
path: dist
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v4
with:
commit-message: 'build: update distribution'
title: Update distribution

View File

@@ -38,4 +38,4 @@ jobs:
MAJOR_VERSION=$(echo $VERSION | sed -n "s/^\([0-9]*\).[0-9]*.[0-9]*$/\1/p")
[[ ${#MAJOR_VERSION} -gt 0 ]] && docker tag $IMAGE_NAME $IMAGE_NAME:$MAJOR_VERSION
docker push $IMAGE_NAME
docker push $IMAGE_NAME --all-tags

View File

@@ -18,16 +18,19 @@ This is useful if you `docker push` your images to Docker Hub. It provides an ea
### Action inputs
**Note**: Docker Hub [Personal Access Tokens](https://docs.docker.com/docker-hub/access-tokens/) cannot be used as they are not supported by the API. See [here](https://github.com/docker/hub-feedback/issues/1927) and [here](https://github.com/docker/hub-feedback/issues/1914) for further details. Unfortunately, this means that enabling 2FA on Docker Hub will prevent the action from working.
| Name | Description | Default |
| --- | --- | --- |
| `username` | (**required**) Docker Hub username. If updating a Docker Hub repository belonging to an organization, this user must have `Admin` permissions for the repository. | |
| `password` | (**required**) Docker Hub password. | |
| `password` | (**required**) Docker Hub password or [Personal Access Token](https://docs.docker.com/docker-hub/access-tokens/) with `read/write/delete` scope. | |
| `repository` | Docker Hub repository in the format `<namespace>/<name>`. | `github.repository` |
| `short-description` | Docker Hub repository short description. Input exceeding 100 characters will be truncated. | |
| `short-description` | Docker Hub repository short description. | |
| `readme-filepath` | Path to the repository readme. | `./README.md` |
#### Content limits
DockerHub has content limits, which if exceeded will result in the content being automatically truncated.
The readme content is limited to 25,000 bytes, and `short-description` is limited to 100 characters.
#### Specifying the file path
The action assumes that there is a file called `README.md` located at the root of the repository.

View File

@@ -6,16 +6,14 @@ inputs:
description: Docker Hub username
required: true
password:
description: Docker Hub password
description: Docker Hub password or Personal Access Token with read/write/delete scope
required: true
repository:
description: >
Docker Hub repository in the format `<namespace>/<name>`
Default: `github.repository`
short-description:
description: >
Docker Hub repository short description
Input exceeding 100 characters will be truncated
description: Docker Hub repository short description
readme-filepath:
description: >
Path to the repository readme

1823
dist/index.js vendored

File diff suppressed because it is too large Load Diff

49
package-lock.json generated
View File

@@ -9,7 +9,7 @@
"version": "3.0.0",
"license": "MIT",
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/core": "^1.10.0",
"node-fetch": "^2.6.7"
},
"devDependencies": {
@@ -29,19 +29,20 @@
}
},
"node_modules/@actions/core": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz",
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"dependencies": {
"@actions/http-client": "^1.0.11"
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"node_modules/@actions/http-client": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"dependencies": {
"tunnel": "0.0.6"
"tunnel": "^0.0.6"
}
},
"node_modules/@babel/code-frame": {
@@ -5878,6 +5879,14 @@
"punycode": "^2.1.0"
}
},
"node_modules/uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
"bin": {
"uuid": "dist/bin/uuid"
}
},
"node_modules/v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",
@@ -6128,19 +6137,20 @@
},
"dependencies": {
"@actions/core": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.6.0.tgz",
"integrity": "sha512-NB1UAZomZlCV/LmJqkLhNTqtKfFXJZAUPcfl/zqG7EfsQdeUJtaWO98SGbuQ3pydJ3fHl2CvI/51OKYlCYYcaw==",
"version": "1.10.0",
"resolved": "https://registry.npmjs.org/@actions/core/-/core-1.10.0.tgz",
"integrity": "sha512-2aZDDa3zrrZbP5ZYg159sNoLRb61nQ7awl5pSvIq5Qpj81vwDzdMRKzkWJGJuwVvWpvZKx7vspJALyvaaIQyug==",
"requires": {
"@actions/http-client": "^1.0.11"
"@actions/http-client": "^2.0.1",
"uuid": "^8.3.2"
}
},
"@actions/http-client": {
"version": "1.0.11",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-1.0.11.tgz",
"integrity": "sha512-VRYHGQV1rqnROJqdMvGUbY/Kn8vriQe/F9HR2AlYHzmKuM/p3kjNuXhmdBfcVgsvRWTz5C5XW5xvndZrVBuAYg==",
"version": "2.0.1",
"resolved": "https://registry.npmjs.org/@actions/http-client/-/http-client-2.0.1.tgz",
"integrity": "sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==",
"requires": {
"tunnel": "0.0.6"
"tunnel": "^0.0.6"
}
},
"@babel/code-frame": {
@@ -10528,6 +10538,11 @@
"punycode": "^2.1.0"
}
},
"uuid": {
"version": "8.3.2",
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg=="
},
"v8-compile-cache": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/v8-compile-cache/-/v8-compile-cache-2.3.0.tgz",

View File

@@ -27,7 +27,7 @@
},
"homepage": "https://github.com/peter-evans/dockerhub-description#readme",
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/core": "^1.10.0",
"node-fetch": "^2.6.7"
},
"devDependencies": {

View File

@@ -2,9 +2,12 @@ import * as core from '@actions/core'
import * as inputHelper from './input-helper'
import * as dockerhubHelper from './dockerhub-helper'
import * as fs from 'fs'
import {inspect, TextEncoder} from 'util'
import {inspect} from 'util'
const MAX_BYTES = 25000
function getErrorMessage(error: unknown) {
if (error instanceof Error) return error.message
return String(error)
}
async function run(): Promise<void> {
try {
@@ -17,12 +20,6 @@ async function run(): Promise<void> {
const readmeContent = await fs.promises.readFile(inputs.readmeFilepath, {
encoding: 'utf8'
})
const byteLength = new TextEncoder().encode(readmeContent).length
if (byteLength > MAX_BYTES) {
throw new Error(
`File size exceeds the maximum allowed ${MAX_BYTES} bytes`
)
}
// Acquire a token for the Docker Hub API
core.info('Acquiring token')
@@ -39,9 +36,9 @@ async function run(): Promise<void> {
readmeContent
)
core.info('Request successful')
} catch (error: any) {
} catch (error) {
core.debug(inspect(error))
core.setFailed(error.message)
core.setFailed(getErrorMessage(error))
}
}