Skip to content

Commit da89008

Browse files
authored
Merge pull request #71 from peter-evans/rm-byte-limit
feat: remove error when content limit exceeded
2 parents 22ceabb + afa309e commit da89008

File tree

4 files changed

+8
-18
lines changed

4 files changed

+8
-18
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,14 @@ This is useful if you `docker push` your images to Docker Hub. It provides an ea
2323
| `username` | (**required**) Docker Hub username. If updating a Docker Hub repository belonging to an organization, this user must have `Admin` permissions for the repository. | |
2424
| `password` | (**required**) Docker Hub password or [Personal Access Token](https://docs.docker.com/docker-hub/access-tokens/) with `read/write/delete` scope. | |
2525
| `repository` | Docker Hub repository in the format `<namespace>/<name>`. | `github.repository` |
26-
| `short-description` | Docker Hub repository short description. Input exceeding 100 characters will be truncated. | |
26+
| `short-description` | Docker Hub repository short description. | |
2727
| `readme-filepath` | Path to the repository readme. | `./README.md` |
2828

29+
#### Content limits
30+
31+
DockerHub has content limits, which if exceeded will result in the content being automatically truncated.
32+
The readme content is limited to 25,000 bytes, and `short-description` is limited to 100 characters.
33+
2934
#### Specifying the file path
3035

3136
The action assumes that there is a file called `README.md` located at the root of the repository.

action.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ inputs:
1313
Docker Hub repository in the format `<namespace>/<name>`
1414
Default: `github.repository`
1515
short-description:
16-
description: >
17-
Docker Hub repository short description
18-
Input exceeding 100 characters will be truncated
16+
description: Docker Hub repository short description
1917
readme-filepath:
2018
description: >
2119
Path to the repository readme

dist/index.js

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,6 @@ const inputHelper = __importStar(__nccwpck_require__(480));
212212
const dockerhubHelper = __importStar(__nccwpck_require__(812));
213213
const fs = __importStar(__nccwpck_require__(147));
214214
const util_1 = __nccwpck_require__(837);
215-
const MAX_BYTES = 25000;
216215
function run() {
217216
return __awaiter(this, void 0, void 0, function* () {
218217
try {
@@ -223,10 +222,6 @@ function run() {
223222
const readmeContent = yield fs.promises.readFile(inputs.readmeFilepath, {
224223
encoding: 'utf8'
225224
});
226-
const byteLength = new util_1.TextEncoder().encode(readmeContent).length;
227-
if (byteLength > MAX_BYTES) {
228-
throw new Error(`File size exceeds the maximum allowed ${MAX_BYTES} bytes`);
229-
}
230225
// Acquire a token for the Docker Hub API
231226
core.info('Acquiring token');
232227
const token = yield dockerhubHelper.getToken(inputs.username, inputs.password);

src/main.ts

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,7 @@ import * as core from '@actions/core'
22
import * as inputHelper from './input-helper'
33
import * as dockerhubHelper from './dockerhub-helper'
44
import * as fs from 'fs'
5-
import {inspect, TextEncoder} from 'util'
6-
7-
const MAX_BYTES = 25000
5+
import {inspect} from 'util'
86

97
async function run(): Promise<void> {
108
try {
@@ -17,12 +15,6 @@ async function run(): Promise<void> {
1715
const readmeContent = await fs.promises.readFile(inputs.readmeFilepath, {
1816
encoding: 'utf8'
1917
})
20-
const byteLength = new TextEncoder().encode(readmeContent).length
21-
if (byteLength > MAX_BYTES) {
22-
throw new Error(
23-
`File size exceeds the maximum allowed ${MAX_BYTES} bytes`
24-
)
25-
}
2618

2719
// Acquire a token for the Docker Hub API
2820
core.info('Acquiring token')

0 commit comments

Comments
 (0)