Compare commits
42 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
616d1b63e8 | ||
|
|
76c5a90afd | ||
|
|
ae9aa33b7a | ||
|
|
54a7a303dd | ||
|
|
73ac163f37 | ||
|
|
582deb1a76 | ||
|
|
af2d781270 | ||
|
|
c9ab1334ce | ||
|
|
acbe71233a | ||
|
|
9c6c243f1d | ||
|
|
789f11f261 | ||
|
|
b45eba2bbb | ||
|
|
95dee52e1c | ||
|
|
041efd9199 | ||
|
|
f7242b77a5 | ||
|
|
da75b33366 | ||
|
|
7dedddda13 | ||
|
|
bc29825a35 | ||
|
|
9aa16a4f71 | ||
|
|
a5a2b94bf3 | ||
|
|
fe4fd29897 | ||
|
|
1087364d83 | ||
|
|
e9afc858d8 | ||
|
|
97e5f46ce8 | ||
|
|
9627b85954 | ||
|
|
78d978464e | ||
|
|
71b8c97334 | ||
|
|
773f327409 | ||
|
|
4b076256d2 | ||
|
|
d4e0800ec5 | ||
|
|
91342cc8a6 | ||
|
|
6443116500 | ||
|
|
445b7e95b6 | ||
|
|
cdce24d19d | ||
|
|
dc17467ac6 | ||
|
|
4b080f0994 | ||
|
|
1d0dd5623c | ||
|
|
8dd2813668 | ||
|
|
dac62d382a | ||
|
|
c4ad60f25c | ||
|
|
3cf73e9a56 | ||
|
|
227aa80eb9 |
@@ -9,8 +9,7 @@
|
||||
"plugin:import/errors",
|
||||
"plugin:import/warnings",
|
||||
"plugin:import/typescript",
|
||||
"plugin:prettier/recommended",
|
||||
"prettier/@typescript-eslint"
|
||||
"plugin:prettier/recommended"
|
||||
],
|
||||
"plugins": ["@typescript-eslint"],
|
||||
"rules": {
|
||||
|
||||
8
.github/workflows/ci.yml
vendored
8
.github/workflows/ci.yml
vendored
@@ -1,12 +1,12 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches: [master]
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'docs/**'
|
||||
pull_request:
|
||||
branches: [master]
|
||||
branches: [main]
|
||||
paths-ignore:
|
||||
- 'README.md'
|
||||
- 'docs/**'
|
||||
@@ -76,7 +76,7 @@ jobs:
|
||||
DOCKERHUB_REPOSITORY: peterevans/dd-ci-fixture-${{ matrix.target }}
|
||||
|
||||
package:
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
|
||||
needs: [test]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -91,7 +91,7 @@ jobs:
|
||||
commit-message: 'build: update distribution'
|
||||
title: Update distribution
|
||||
body: |
|
||||
- Updates the distribution for changes on `master`
|
||||
- Updates the distribution for changes on `main`
|
||||
|
||||
Auto-generated by [create-pull-request][1]
|
||||
|
||||
|
||||
5
.github/workflows/dockerhub-description.yml
vendored
5
.github/workflows/dockerhub-description.yml
vendored
@@ -3,7 +3,7 @@ on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- README.md
|
||||
- .github/workflows/dockerhub-description.yml
|
||||
@@ -16,7 +16,7 @@ jobs:
|
||||
- name: Modify readme for DockerHub
|
||||
run: |
|
||||
sed -i 's/# Docker Hub Description/# [Docker Hub Description](https:\/\/github.com\/peter-evans\/dockerhub-description)/' README.md
|
||||
sed -i 's/(LICENSE)/(https:\/\/github.com\/peter-evans\/dockerhub-description\/blob\/master\/LICENSE)/' README.md
|
||||
sed -i 's/(LICENSE)/(https:\/\/github.com\/peter-evans\/dockerhub-description\/blob\/main\/LICENSE)/' README.md
|
||||
|
||||
- name: Docker Hub Description
|
||||
uses: ./
|
||||
@@ -24,3 +24,4 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
repository: peterevans/dockerhub-description
|
||||
short-description: ${{ github.event.repository.description }}
|
||||
|
||||
4
.github/workflows/publish-docker.yml
vendored
4
.github/workflows/publish-docker.yml
vendored
@@ -2,7 +2,7 @@ name: Publish Docker Image
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
tags:
|
||||
- v*
|
||||
env:
|
||||
@@ -25,7 +25,7 @@ jobs:
|
||||
[[ "${{ github.ref }}" == "refs/tags/"* ]] && VERSION=$(echo $VERSION | sed -e 's/^v//')
|
||||
|
||||
# Use Docker `latest` tag convention
|
||||
[ "$VERSION" == "master" ] && VERSION=latest
|
||||
[ "$VERSION" == "main" ] && VERSION=latest
|
||||
|
||||
# Build and tag image
|
||||
docker build . --file Dockerfile --tag $IMAGE_NAME --label "org.opencontainers.image.version=$VERSION"
|
||||
|
||||
20
README.md
20
README.md
@@ -43,16 +43,30 @@ If this is not the case the path can be specified with the `readme-filepath` inp
|
||||
readme-filepath: ./path/to/README.md
|
||||
```
|
||||
|
||||
#### Using the GitHub repository description
|
||||
|
||||
The GitHub repository description can be used for the Docker Hub `short-descripton` by passing the description from the event context.
|
||||
|
||||
```yml
|
||||
- name: Docker Hub Description
|
||||
uses: peter-evans/dockerhub-description@v2
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
repository: peterevans/dockerhub-description
|
||||
short-description: ${{ github.event.repository.description }}
|
||||
```
|
||||
|
||||
### Examples
|
||||
|
||||
The following workflow updates the Docker Hub repository description whenever there are changes to `README.md` and the workflow file itself on the `master` branch. This workflow assumes its location to be `.github/workflows/dockerhub-description.yml`.
|
||||
The following workflow updates the Docker Hub repository description whenever there are changes to `README.md` and the workflow file itself on the `main` branch. This workflow assumes its location to be `.github/workflows/dockerhub-description.yml`.
|
||||
|
||||
```yml
|
||||
name: Update Docker Hub Description
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
- main
|
||||
paths:
|
||||
- README.md
|
||||
- .github/workflows/dockerhub-description.yml
|
||||
@@ -68,6 +82,7 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
repository: peterevans/dockerhub-description
|
||||
short-description: ${{ github.event.repository.description }}
|
||||
```
|
||||
|
||||
Updates the Docker Hub repository description whenever a new release is created.
|
||||
@@ -87,6 +102,7 @@ jobs:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_PASSWORD }}
|
||||
repository: peterevans/dockerhub-description
|
||||
short-description: ${{ github.event.repository.description }}
|
||||
```
|
||||
|
||||
## Using the Docker image independently of GitHub Actions
|
||||
|
||||
285
dist/index.js
vendored
285
dist/index.js
vendored
@@ -1,9 +1,8 @@
|
||||
module.exports =
|
||||
/******/ (() => { // webpackBootstrap
|
||||
/******/ var __webpack_modules__ = ({
|
||||
|
||||
/***/ 812:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
@@ -37,8 +36,8 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.updateRepositoryDescription = exports.getToken = void 0;
|
||||
const core = __importStar(__webpack_require__(186));
|
||||
const fetch = __importStar(__webpack_require__(467));
|
||||
const core = __importStar(__nccwpck_require__(186));
|
||||
const fetch = __importStar(__nccwpck_require__(467));
|
||||
const DESCRIPTION_MAX_CHARS = 100;
|
||||
function getToken(username, password) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
@@ -51,6 +50,9 @@ function getToken(username, password) {
|
||||
body: JSON.stringify(body),
|
||||
headers: { 'Content-Type': 'application/json' }
|
||||
});
|
||||
if (!response.ok) {
|
||||
throw new Error(`Unexpected response: ${response.status} ${response.statusText}`);
|
||||
}
|
||||
const json = yield response.json();
|
||||
core.setSecret(json['token']);
|
||||
return json['token'];
|
||||
@@ -72,6 +74,10 @@ function updateRepositoryDescription(token, repository, description, fullDescrip
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `JWT ${token}`
|
||||
}
|
||||
}).then(res => {
|
||||
if (!res.ok) {
|
||||
throw new Error(res.statusText);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -81,7 +87,7 @@ exports.updateRepositoryDescription = updateRepositoryDescription;
|
||||
/***/ }),
|
||||
|
||||
/***/ 480:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
@@ -106,7 +112,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.validateInputs = exports.getInputs = void 0;
|
||||
const core = __importStar(__webpack_require__(186));
|
||||
const core = __importStar(__nccwpck_require__(186));
|
||||
const README_FILEPATH_DEFAULT = './README.md';
|
||||
function getInputs() {
|
||||
const inputs = {
|
||||
@@ -148,6 +154,8 @@ function getInputs() {
|
||||
if (!inputs.repository && process.env['GITHUB_REPOSITORY']) {
|
||||
inputs.repository = process.env['GITHUB_REPOSITORY'];
|
||||
}
|
||||
// Docker repositories must be all lower case
|
||||
inputs.repository = inputs.repository.toLowerCase();
|
||||
return inputs;
|
||||
}
|
||||
exports.getInputs = getInputs;
|
||||
@@ -166,7 +174,7 @@ exports.validateInputs = validateInputs;
|
||||
/***/ }),
|
||||
|
||||
/***/ 109:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
@@ -199,11 +207,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
});
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const core = __importStar(__webpack_require__(186));
|
||||
const inputHelper = __importStar(__webpack_require__(480));
|
||||
const dockerhubHelper = __importStar(__webpack_require__(812));
|
||||
const fs = __importStar(__webpack_require__(747));
|
||||
const util_1 = __webpack_require__(669);
|
||||
const core = __importStar(__nccwpck_require__(186));
|
||||
const inputHelper = __importStar(__nccwpck_require__(480));
|
||||
const dockerhubHelper = __importStar(__nccwpck_require__(812));
|
||||
const fs = __importStar(__nccwpck_require__(747));
|
||||
const util_1 = __nccwpck_require__(669);
|
||||
const MAX_BYTES = 25000;
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
@@ -239,19 +247,33 @@ run();
|
||||
/***/ }),
|
||||
|
||||
/***/ 351:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
exports.issue = exports.issueCommand = void 0;
|
||||
const os = __importStar(__nccwpck_require__(87));
|
||||
const utils_1 = __nccwpck_require__(278);
|
||||
/**
|
||||
* Commands
|
||||
*
|
||||
@@ -305,28 +327,14 @@ class Command {
|
||||
return cmdStr;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
function toCommandValue(input) {
|
||||
if (input === null || input === undefined) {
|
||||
return '';
|
||||
}
|
||||
else if (typeof input === 'string' || input instanceof String) {
|
||||
return input;
|
||||
}
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
function escapeData(s) {
|
||||
return toCommandValue(s)
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A');
|
||||
}
|
||||
function escapeProperty(s) {
|
||||
return toCommandValue(s)
|
||||
return utils_1.toCommandValue(s)
|
||||
.replace(/%/g, '%25')
|
||||
.replace(/\r/g, '%0D')
|
||||
.replace(/\n/g, '%0A')
|
||||
@@ -338,10 +346,29 @@ function escapeProperty(s) {
|
||||
/***/ }),
|
||||
|
||||
/***/ 186:
|
||||
/***/ (function(__unused_webpack_module, exports, __webpack_require__) {
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||
return new (P || (P = Promise))(function (resolve, reject) {
|
||||
@@ -351,17 +378,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||
});
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
const command_1 = __webpack_require__(351);
|
||||
const os = __importStar(__webpack_require__(87));
|
||||
const path = __importStar(__webpack_require__(622));
|
||||
exports.getState = exports.saveState = exports.group = exports.endGroup = exports.startGroup = exports.info = exports.warning = exports.error = exports.debug = exports.isDebug = exports.setFailed = exports.setCommandEcho = exports.setOutput = exports.getBooleanInput = exports.getInput = exports.addPath = exports.setSecret = exports.exportVariable = exports.ExitCode = void 0;
|
||||
const command_1 = __nccwpck_require__(351);
|
||||
const file_command_1 = __nccwpck_require__(717);
|
||||
const utils_1 = __nccwpck_require__(278);
|
||||
const os = __importStar(__nccwpck_require__(87));
|
||||
const path = __importStar(__nccwpck_require__(622));
|
||||
/**
|
||||
* The code to exit an action
|
||||
*/
|
||||
@@ -386,9 +409,17 @@ var ExitCode;
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function exportVariable(name, val) {
|
||||
const convertedVal = command_1.toCommandValue(val);
|
||||
const convertedVal = utils_1.toCommandValue(val);
|
||||
process.env[name] = convertedVal;
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
const filePath = process.env['GITHUB_ENV'] || '';
|
||||
if (filePath) {
|
||||
const delimiter = '_GitHubActionsFileCommandDelimeter_';
|
||||
const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;
|
||||
file_command_1.issueCommand('ENV', commandValue);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('set-env', { name }, convertedVal);
|
||||
}
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
@@ -404,12 +435,20 @@ exports.setSecret = setSecret;
|
||||
* @param inputPath
|
||||
*/
|
||||
function addPath(inputPath) {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
const filePath = process.env['GITHUB_PATH'] || '';
|
||||
if (filePath) {
|
||||
file_command_1.issueCommand('PATH', inputPath);
|
||||
}
|
||||
else {
|
||||
command_1.issueCommand('add-path', {}, inputPath);
|
||||
}
|
||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||
}
|
||||
exports.addPath = addPath;
|
||||
/**
|
||||
* Gets the value of an input. The value is also trimmed.
|
||||
* Gets the value of an input.
|
||||
* Unless trimWhitespace is set to false in InputOptions, the value is also trimmed.
|
||||
* Returns an empty string if the value is not defined.
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
@@ -420,9 +459,34 @@ function getInput(name, options) {
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
if (options && options.trimWhitespace === false) {
|
||||
return val;
|
||||
}
|
||||
return val.trim();
|
||||
}
|
||||
exports.getInput = getInput;
|
||||
/**
|
||||
* Gets the input value of the boolean type in the YAML 1.2 "core schema" specification.
|
||||
* Support boolean input list: `true | True | TRUE | false | False | FALSE` .
|
||||
* The return value is also in boolean type.
|
||||
* ref: https://yaml.org/spec/1.2/spec.html#id2804923
|
||||
*
|
||||
* @param name name of the input to get
|
||||
* @param options optional. See InputOptions.
|
||||
* @returns boolean
|
||||
*/
|
||||
function getBooleanInput(name, options) {
|
||||
const trueValue = ['true', 'True', 'TRUE'];
|
||||
const falseValue = ['false', 'False', 'FALSE'];
|
||||
const val = getInput(name, options);
|
||||
if (trueValue.includes(val))
|
||||
return true;
|
||||
if (falseValue.includes(val))
|
||||
return false;
|
||||
throw new TypeError(`Input does not meet YAML 1.2 "Core Schema" specification: ${name}\n` +
|
||||
`Support boolean input list: \`true | True | TRUE | false | False | FALSE\``);
|
||||
}
|
||||
exports.getBooleanInput = getBooleanInput;
|
||||
/**
|
||||
* Sets the value of an output.
|
||||
*
|
||||
@@ -431,6 +495,7 @@ exports.getInput = getInput;
|
||||
*/
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
function setOutput(name, value) {
|
||||
process.stdout.write(os.EOL);
|
||||
command_1.issueCommand('set-output', { name }, value);
|
||||
}
|
||||
exports.setOutput = setOutput;
|
||||
@@ -566,8 +631,84 @@ exports.getState = getState;
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 717:
|
||||
/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) {
|
||||
|
||||
"use strict";
|
||||
|
||||
// For internal use, subject to change.
|
||||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
||||
}) : (function(o, m, k, k2) {
|
||||
if (k2 === undefined) k2 = k;
|
||||
o[k2] = m[k];
|
||||
}));
|
||||
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
||||
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
||||
}) : function(o, v) {
|
||||
o["default"] = v;
|
||||
});
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (k !== "default" && Object.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
||||
__setModuleDefault(result, mod);
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.issueCommand = void 0;
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
const fs = __importStar(__nccwpck_require__(747));
|
||||
const os = __importStar(__nccwpck_require__(87));
|
||||
const utils_1 = __nccwpck_require__(278);
|
||||
function issueCommand(command, message) {
|
||||
const filePath = process.env[`GITHUB_${command}`];
|
||||
if (!filePath) {
|
||||
throw new Error(`Unable to find environment variable for file command ${command}`);
|
||||
}
|
||||
if (!fs.existsSync(filePath)) {
|
||||
throw new Error(`Missing file at path: ${filePath}`);
|
||||
}
|
||||
fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {
|
||||
encoding: 'utf8'
|
||||
});
|
||||
}
|
||||
exports.issueCommand = issueCommand;
|
||||
//# sourceMappingURL=file-command.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 278:
|
||||
/***/ ((__unused_webpack_module, exports) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
// We use any as a valid input type
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
exports.toCommandValue = void 0;
|
||||
/**
|
||||
* Sanitizes an input into a string so it can be passed into issueCommand safely
|
||||
* @param input input to sanitize into a string
|
||||
*/
|
||||
function toCommandValue(input) {
|
||||
if (input === null || input === undefined) {
|
||||
return '';
|
||||
}
|
||||
else if (typeof input === 'string' || input instanceof String) {
|
||||
return input;
|
||||
}
|
||||
return JSON.stringify(input);
|
||||
}
|
||||
exports.toCommandValue = toCommandValue;
|
||||
//# sourceMappingURL=utils.js.map
|
||||
|
||||
/***/ }),
|
||||
|
||||
/***/ 467:
|
||||
/***/ ((module, exports, __webpack_require__) => {
|
||||
/***/ ((module, exports, __nccwpck_require__) => {
|
||||
|
||||
"use strict";
|
||||
|
||||
@@ -576,11 +717,11 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
||||
|
||||
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
|
||||
|
||||
var Stream = _interopDefault(__webpack_require__(413));
|
||||
var http = _interopDefault(__webpack_require__(605));
|
||||
var Url = _interopDefault(__webpack_require__(835));
|
||||
var https = _interopDefault(__webpack_require__(211));
|
||||
var zlib = _interopDefault(__webpack_require__(761));
|
||||
var Stream = _interopDefault(__nccwpck_require__(413));
|
||||
var http = _interopDefault(__nccwpck_require__(605));
|
||||
var Url = _interopDefault(__nccwpck_require__(835));
|
||||
var https = _interopDefault(__nccwpck_require__(211));
|
||||
var zlib = _interopDefault(__nccwpck_require__(761));
|
||||
|
||||
// Based on https://github.com/tmpvar/jsdom/blob/aa85b2abf07766ff7bf5c1f6daafb3726f2f2db5/lib/jsdom/living/blob.js
|
||||
|
||||
@@ -731,7 +872,7 @@ FetchError.prototype.name = 'FetchError';
|
||||
|
||||
let convert;
|
||||
try {
|
||||
convert = __webpack_require__(877).convert;
|
||||
convert = __nccwpck_require__(877).convert;
|
||||
} catch (e) {}
|
||||
|
||||
const INTERNALS = Symbol('Body internals');
|
||||
@@ -2235,7 +2376,7 @@ module.exports = eval("require")("encoding");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("fs");
|
||||
module.exports = require("fs");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -2243,7 +2384,7 @@ module.exports = require("fs");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("http");
|
||||
module.exports = require("http");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -2251,7 +2392,7 @@ module.exports = require("http");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("https");
|
||||
module.exports = require("https");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -2259,7 +2400,7 @@ module.exports = require("https");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("os");
|
||||
module.exports = require("os");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -2267,7 +2408,7 @@ module.exports = require("os");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("path");
|
||||
module.exports = require("path");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -2275,7 +2416,7 @@ module.exports = require("path");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("stream");
|
||||
module.exports = require("stream");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -2283,7 +2424,7 @@ module.exports = require("stream");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("url");
|
||||
module.exports = require("url");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -2291,7 +2432,7 @@ module.exports = require("url");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("util");
|
||||
module.exports = require("util");;
|
||||
|
||||
/***/ }),
|
||||
|
||||
@@ -2299,7 +2440,7 @@ module.exports = require("util");
|
||||
/***/ ((module) => {
|
||||
|
||||
"use strict";
|
||||
module.exports = require("zlib");
|
||||
module.exports = require("zlib");;
|
||||
|
||||
/***/ })
|
||||
|
||||
@@ -2309,10 +2450,11 @@ module.exports = require("zlib");
|
||||
/******/ var __webpack_module_cache__ = {};
|
||||
/******/
|
||||
/******/ // The require function
|
||||
/******/ function __webpack_require__(moduleId) {
|
||||
/******/ function __nccwpck_require__(moduleId) {
|
||||
/******/ // Check if module is in cache
|
||||
/******/ if(__webpack_module_cache__[moduleId]) {
|
||||
/******/ return __webpack_module_cache__[moduleId].exports;
|
||||
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
||||
/******/ if (cachedModule !== undefined) {
|
||||
/******/ return cachedModule.exports;
|
||||
/******/ }
|
||||
/******/ // Create a new module (and put it into the cache)
|
||||
/******/ var module = __webpack_module_cache__[moduleId] = {
|
||||
@@ -2324,7 +2466,7 @@ module.exports = require("zlib");
|
||||
/******/ // Execute the module function
|
||||
/******/ var threw = true;
|
||||
/******/ try {
|
||||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __webpack_require__);
|
||||
/******/ __webpack_modules__[moduleId].call(module.exports, module, module.exports, __nccwpck_require__);
|
||||
/******/ threw = false;
|
||||
/******/ } finally {
|
||||
/******/ if(threw) delete __webpack_module_cache__[moduleId];
|
||||
@@ -2337,10 +2479,13 @@ module.exports = require("zlib");
|
||||
/************************************************************************/
|
||||
/******/ /* webpack/runtime/compat */
|
||||
/******/
|
||||
/******/ __webpack_require__.ab = __dirname + "/";/************************************************************************/
|
||||
/******/ // module exports must be returned from runtime so entry inlining is disabled
|
||||
/******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
|
||||
/******/
|
||||
/******/ // startup
|
||||
/******/ // Load entry module and return exports
|
||||
/******/ return __webpack_require__(109);
|
||||
/******/ // This entry module is referenced by other modules so it can't be inlined
|
||||
/******/ var __webpack_exports__ = __nccwpck_require__(109);
|
||||
/******/ module.exports = __webpack_exports__;
|
||||
/******/
|
||||
/******/ })()
|
||||
;
|
||||
13336
package-lock.json
generated
13336
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
28
package.json
28
package.json
@@ -27,22 +27,22 @@
|
||||
},
|
||||
"homepage": "https://github.com/peter-evans/dockerhub-description#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "1.2.5",
|
||||
"@actions/core": "1.3.0",
|
||||
"node-fetch": "2.6.1"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "26.0.14",
|
||||
"@types/node": "14.10.3",
|
||||
"@typescript-eslint/parser": "4.1.1",
|
||||
"@vercel/ncc": "0.24.1",
|
||||
"eslint": "7.9.0",
|
||||
"eslint-plugin-github": "4.1.1",
|
||||
"eslint-plugin-jest": "24.0.1",
|
||||
"jest": "26.4.2",
|
||||
"jest-circus": "26.4.2",
|
||||
"js-yaml": "3.14.0",
|
||||
"prettier": "2.1.2",
|
||||
"ts-jest": "26.3.0",
|
||||
"typescript": "4.0.2"
|
||||
"@types/jest": "26.0.23",
|
||||
"@types/node": "15.6.1",
|
||||
"@typescript-eslint/parser": "4.25.0",
|
||||
"@vercel/ncc": "0.28.6",
|
||||
"eslint": "7.27.0",
|
||||
"eslint-plugin-github": "4.1.3",
|
||||
"eslint-plugin-jest": "24.3.6",
|
||||
"jest": "27.0.1",
|
||||
"jest-circus": "27.0.1",
|
||||
"js-yaml": "4.1.0",
|
||||
"prettier": "2.3.0",
|
||||
"ts-jest": "27.0.1",
|
||||
"typescript": "4.3.2"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,11 @@ export async function getToken(
|
||||
body: JSON.stringify(body),
|
||||
headers: {'Content-Type': 'application/json'}
|
||||
})
|
||||
if (!response.ok) {
|
||||
throw new Error(
|
||||
`Unexpected response: ${response.status} ${response.statusText}`
|
||||
)
|
||||
}
|
||||
const json = await response.json()
|
||||
core.setSecret(json['token'])
|
||||
return json['token']
|
||||
@@ -40,5 +45,9 @@ export async function updateRepositoryDescription(
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `JWT ${token}`
|
||||
}
|
||||
}).then(res => {
|
||||
if (!res.ok) {
|
||||
throw new Error(res.statusText)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@@ -58,6 +58,9 @@ export function getInputs(): Inputs {
|
||||
inputs.repository = process.env['GITHUB_REPOSITORY']
|
||||
}
|
||||
|
||||
// Docker repositories must be all lower case
|
||||
inputs.repository = inputs.repository.toLowerCase()
|
||||
|
||||
return inputs
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user