From 75ce03b6a055a3be9d936a3a99c51038bd72298c Mon Sep 17 00:00:00 2001 From: rlespinasse Date: Mon, 25 Jan 2021 20:49:01 +0100 Subject: [PATCH] feat: support partial GITHUB_REPOSITORY --- .github/workflows/build.yml | 22 ++++-- README.md | 47 ++++++++----- __tests__/partial.test.ts | 28 ++++++++ __tests__/shortsha.test.ts | 2 +- dist/index.js | 136 +++++++++++++++++++++++++++++++----- dist/index.js.map | 2 +- docs/partial-variables.md | 28 ++++++++ docs/slug-url-variables.md | 37 ++++++++-- docs/slug-variables.md | 41 +++++++++-- examples/linux-usage.yml | 11 ++- examples/macos-usage.yml | 11 ++- examples/windows-usage.yml | 11 ++- src/main.ts | 125 +++++++++++++++++++++++++++++++-- src/partial.ts | 17 +++++ src/short.ts | 10 +++ src/slug.ts | 10 --- 16 files changed, 467 insertions(+), 71 deletions(-) create mode 100644 __tests__/partial.test.ts create mode 100644 docs/partial-variables.md create mode 100644 src/partial.ts create mode 100644 src/short.ts diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 36eadf0..55a4e50 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,18 +41,25 @@ jobs: - uses: ./ - name: Output run: | + echo "Partial variables" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART }}" echo "Slug variables" + echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG }}" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" echo " ref : ${{ env.GITHUB_REF_SLUG }}" echo " head ref : ${{ env.GITHUB_HEAD_REF_SLUG }}" echo " base ref : ${{ env.GITHUB_BASE_REF_SLUG }}" echo " event ref : ${{ env.GITHUB_EVENT_REF_SLUG }}" - echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG }}" echo "Slug URL variables" + echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL }}" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}" echo " ref : ${{ env.GITHUB_REF_SLUG_URL }}" echo " head ref : ${{ env.GITHUB_HEAD_REF_SLUG_URL }}" echo " base ref : ${{ env.GITHUB_BASE_REF_SLUG_URL }}" echo " event ref : ${{ env.GITHUB_EVENT_REF_SLUG_URL }}" - echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL }}" echo "Short SHA variables" echo " sha : ${{ env.GITHUB_SHA_SHORT }}" echo " pull request sha : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" @@ -64,18 +71,25 @@ jobs: - uses: ./ - name: Output run: | + echo "Partial variables" + echo " repository owner : $env:GITHUB_REPOSITORY_OWNER_PART" + echo " repository name : $env:GITHUB_REPOSITORY_NAME_PART" echo "Slug variables" + echo " repository : $env:GITHUB_REPOSITORY_SLUG" + echo " repository owner : $env:GITHUB_REPOSITORY_OWNER_PART_SLUG" + echo " repository name : $env:GITHUB_REPOSITORY_NAME_PART_SLUG" echo " ref : $env:GITHUB_REF_SLUG" echo " head ref : $env:GITHUB_HEAD_REF_SLUG" echo " base ref : $env:GITHUB_BASE_REF_SLUG" echo " event ref : $env:GITHUB_EVENT_REF_SLUG" - echo " repository : $env:GITHUB_REPOSITORY_SLUG" echo "Slug URL variables" + echo " repository : $env:GITHUB_REPOSITORY_SLUG_URL" + echo " repository owner : $env:GITHUB_REPOSITORY_OWNER_PART_SLUG_URL" + echo " repository name : $env:GITHUB_REPOSITORY_NAME_PART_SLUG_URL" echo " ref : $env:GITHUB_REF_SLUG_URL" echo " head ref : $env:GITHUB_HEAD_REF_SLUG_URL" echo " base ref : $env:GITHUB_BASE_REF_SLUG_URL" echo " event ref : $env:GITHUB_EVENT_REF_SLUG_URL" - echo " repository : $env:GITHUB_REPOSITORY_SLUG_URL" echo "Short SHA variables" echo " sha : $env:GITHUB_SHA_SHORT" echo " pull request sha : $env:GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT" diff --git a/README.md b/README.md index cbb51dc..0f21fe0 100644 --- a/README.md +++ b/README.md @@ -14,6 +14,7 @@ This GitHub Action will expose the slug/short values of [some GitHub environment - [Overview](#overview) - [Use this action](#use-this-action) - [Available Environment variables](#available-environment-variables) + - [Partial variables](#partial-variables) - [Slug variables](#slug-variables) - [Slug URL variables](#slug-url-variables) - [Short variables](#short-variables) @@ -25,7 +26,7 @@ This GitHub Action will expose the slug/short values of [some GitHub environment ## Overview -`SLUG` a variable will +`SLUG` on a variable will - put the variable content in lower case - replace any character by `-` except `0-9`, `a-z`, and `.` @@ -36,8 +37,9 @@ This GitHub Action will expose the slug/short values of [some GitHub environment Others Slug-ish commands are available

-- `SLUG_URL` a variable to have a `slug` variable compliant to be used in an URL (Like `SLUG` but `.` is also replaced by `-`) -- `SHORT` a variable will limit the string size to 8 characters (useful for _sha_ value) +- `SLUG_URL` on a variable to have a `slug` variable compliant to be used in an URL (Like `SLUG` but `.` is also replaced by `-`) +- `SHORT` on a variable will limit the string size to 8 characters (useful for _sha_ value) +- `_PART` on a variable will give a part of a variable defined by a key

@@ -59,25 +61,36 @@ Check for more [examples][3] (OS usage, URL use, ...) **Note**: If you don't find what you search for, read more about [available `GitHub` variables](docs/github-variables.md), and propose a [new custom variable][5]. +### Partial variables + +| Variable | Partial version of | Description | +| -------------------------------------------------------------------------------------- | ------------------ | ------------------------------------------------------ | +| [GITHUB_REPOSITORY_OWNER_PART](docs/partial-variables.md#github_repository_owner_part) | GITHUB_REPOSITORY | The Owner part of GITHUB_REPOSITORY variable | +| [GITHUB_REPOSITORY_NAME_PART](docs/partial-variables.md#github_repository_name_part) | GITHUB_REPOSITORY | The Repository name part of GITHUB_REPOSITORY variable | + ### Slug variables -| Variable | Slug version of | Description | -| ----------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------- | -| [GITHUB_REPOSITORY_SLUG](docs/slug-variables.md#github_repository_slug) | GITHUB_REPOSITORY | The owner and repository name. | -| [GITHUB_REF_SLUG](docs/slug-variables.md#github_ref_slug) | GITHUB_REF | The branch or tag ref that triggered the workflow. | -| [GITHUB_HEAD_REF_SLUG](docs/slug-variables.md#github_head_ref_slug) | GITHUB_HEAD_REF | The branch of the head repository.
Only set for forked repositories. | -| [GITHUB_BASE_REF_SLUG](docs/slug-variables.md#github_base_ref_slug) | GITHUB_BASE_REF | The branch of the base repository.
Only set for forked repositories. | -| [GITHUB_EVENT_REF_SLUG](docs/slug-variables.md#github_event_ref_slug) | _github.event.ref_ |
Only set for [following webhook events][4] | +| Variable | Slug version of | Description | +| --------------------------------------------------------------------------------------------- | ---------------------------- | --------------------------------------------------------------------------------------------------- | +| [GITHUB_REPOSITORY_SLUG](docs/slug-variables.md#github_repository_slug) | GITHUB_REPOSITORY | The owner and repository name. | +| [GITHUB_REPOSITORY_OWNER_PART_SLUG](docs/slug-variables.md#github_repository_owner_part_slug) | GITHUB_REPOSITORY_OWNER_PART | The owner name. | +| [GITHUB_REPOSITORY_NAME_PART_SLUG](docs/slug-variables.md#github_repository_name_part_slug) | GITHUB_REPOSITORY_NAME_PART | The repository name. | +| [GITHUB_REF_SLUG](docs/slug-variables.md#github_ref_slug) | GITHUB_REF | The branch or tag ref that triggered the workflow. | +| [GITHUB_HEAD_REF_SLUG](docs/slug-variables.md#github_head_ref_slug) | GITHUB_HEAD_REF | The branch of the head repository.
Only set for [pull-request][4] event and forked repositories. | +| [GITHUB_BASE_REF_SLUG](docs/slug-variables.md#github_base_ref_slug) | GITHUB_BASE_REF | The branch of the base repository.
Only set for [pull-request][4] event and forked repositories. | +| [GITHUB_EVENT_REF_SLUG](docs/slug-variables.md#github_event_ref_slug) | _github.event.ref_ |
Only set for [following webhook events][4] | ### Slug URL variables -| Variable | Slug version of | Description | -| ----------------------------------------------------------------------------------- | ------------------ | ----------------------------------------------------------------------------------------- | -| [GITHUB_REPOSITORY_SLUG_URL](docs/slug-url-variables.md#github_repository_slug_url) | GITHUB_REPOSITORY | The owner and repository name. | -| [GITHUB_REF_SLUG_URL](docs/slug-url-variables.md#github_ref_slug_url) | GITHUB_REF | The branch or tag ref that triggered the workflow. | -| [GITHUB_HEAD_REF_SLUG_URL](docs/slug-url-variables.md#github_head_ref_slug_url) | GITHUB_HEAD_REF | The branch of the head repository.
Only set for forked repositories. | -| [GITHUB_BASE_REF_SLUG_URL](docs/slug-url-variables.md#github_base_ref_slug_url) | GITHUB_BASE_REF | The branch of the base repository.
Only set for forked repositories. | -| [GITHUB_EVENT_REF_SLUG_URL](docs/slug-url-variables.md#github_event_ref_slug_url) | _github.event.ref_ |
Only set for [following webhook events][4] | +| Variable | Slug URL version of | Description | +| ----------------------------------------------------------------------------------------------------- | ---------------------------- | --------------------------------------------------------------------------------------------------- | +| [GITHUB_REPOSITORY_SLUG_URL](docs/slug-url-variables.md#github_repository_slug_url) | GITHUB_REPOSITORY | The owner and repository name. | +| [GITHUB_REPOSITORY_OWNER_PART_SLUG_URL](docs/slug-variables.md#github_repository_owner_part_slug_url) | GITHUB_REPOSITORY_OWNER_PART | The owner name. | +| [GITHUB_REPOSITORY_NAME_PART_SLUG_URL](docs/slug-variables.md#github_repository_name_part_slug_url) | GITHUB_REPOSITORY_NAME_PART | The repository name. | +| [GITHUB_REF_SLUG_URL](docs/slug-url-variables.md#github_ref_slug_url) | GITHUB_REF | The branch or tag ref that triggered the workflow. | +| [GITHUB_HEAD_REF_SLUG_URL](docs/slug-url-variables.md#github_head_ref_slug_url) | GITHUB_HEAD_REF | The branch of the head repository.
Only set for [pull-request][4] event and forked repositories. | +| [GITHUB_BASE_REF_SLUG_URL](docs/slug-url-variables.md#github_base_ref_slug_url) | GITHUB_BASE_REF | The branch of the base repository.
Only set for [pull-request][4] event and forked repositories. | +| [GITHUB_EVENT_REF_SLUG_URL](docs/slug-url-variables.md#github_event_ref_slug_url) | _github.event.ref_ |
Only set for [following webhook events][4] | ### Short variables diff --git a/__tests__/partial.test.ts b/__tests__/partial.test.ts new file mode 100644 index 0000000..0788cd1 --- /dev/null +++ b/__tests__/partial.test.ts @@ -0,0 +1,28 @@ +import {sep} from 'path' +import {get_first_part, get_second_part} from '../src/partial' + +function test_get_first_part( + input: string, + separator: string, + expected: string +) { + let actual = get_first_part(input, separator) + expect(actual).toEqual(expected) +} + +function test_get_second_part( + input: string, + separator: string, + expected: string +) { + let actual = get_second_part(input, separator) + expect(actual).toEqual(expected) +} + +test('get_first_part', () => { + test_get_first_part('first/second', '/', 'first') +}) + +test('get_second_part', () => { + test_get_second_part('first/second', '/', 'second') +}) diff --git a/__tests__/shortsha.test.ts b/__tests__/shortsha.test.ts index aca9072..f24a225 100644 --- a/__tests__/shortsha.test.ts +++ b/__tests__/shortsha.test.ts @@ -1,4 +1,4 @@ -import {shortsha} from '../src/slug' +import {shortsha} from '../src/short' function test_short_sha(input: string, expected: string) { let actual = shortsha(input) diff --git a/dist/index.js b/dist/index.js index c976912..c4d818d 100644 --- a/dist/index.js +++ b/dist/index.js @@ -92,6 +92,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge Object.defineProperty(exports, "__esModule", { value: true }); const core = __importStar(__webpack_require__(186)); const slug_1 = __webpack_require__(565); +const short_1 = __webpack_require__(213); +const partial_1 = __webpack_require__(373); +const SEPARATOR = '/'; /** * Inputs environments variables keys from Github actions job * see https://docs.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables @@ -102,20 +105,35 @@ const GITHUB_HEAD_REF = 'GITHUB_HEAD_REF'; const GITHUB_BASE_REF = 'GITHUB_BASE_REF'; const GITHUB_SHA = 'GITHUB_SHA'; const GITHUB_EVENT_PATH = 'GITHUB_EVENT_PATH'; +/** + * Partial outputs environments variables keys + */ +const GITHUB_REPOSITORY_OWNER_PART = 'GITHUB_REPOSITORY_OWNER_PART'; +const GITHUB_REPOSITORY_NAME_PART = 'GITHUB_REPOSITORY_NAME_PART'; /** * Slugged outputs environments variables keys */ const GITHUB_REPOSITORY_SLUG = 'GITHUB_REPOSITORY_SLUG'; -const GITHUB_REPOSITORY_SLUG_URL = 'GITHUB_REPOSITORY_SLUG_URL'; +const GITHUB_REPOSITORY_OWNER_PART_SLUG = 'GITHUB_REPOSITORY_OWNER_PART_SLUG'; +const GITHUB_REPOSITORY_NAME_PART_SLUG = 'GITHUB_REPOSITORY_NAME_PART_SLUG'; const GITHUB_REF_SLUG = 'GITHUB_REF_SLUG'; const GITHUB_HEAD_REF_SLUG = 'GITHUB_HEAD_REF_SLUG'; const GITHUB_BASE_REF_SLUG = 'GITHUB_BASE_REF_SLUG'; +const GITHUB_EVENT_REF_SLUG = 'GITHUB_EVENT_REF_SLUG'; +/** + * URL-Slugged outputs environments variables keys + */ +const GITHUB_REPOSITORY_SLUG_URL = 'GITHUB_REPOSITORY_SLUG_URL'; +const GITHUB_REPOSITORY_OWNER_PART_SLUG_URL = 'GITHUB_REPOSITORY_OWNER_PART_SLUG_URL'; +const GITHUB_REPOSITORY_NAME_PART_SLUG_URL = 'GITHUB_REPOSITORY_NAME_PART_SLUG_URL'; const GITHUB_REF_SLUG_URL = 'GITHUB_REF_SLUG_URL'; const GITHUB_HEAD_REF_SLUG_URL = 'GITHUB_HEAD_REF_SLUG_URL'; const GITHUB_BASE_REF_SLUG_URL = 'GITHUB_BASE_REF_SLUG_URL'; -const GITHUB_SHA_SHORT = 'GITHUB_SHA_SHORT'; -const GITHUB_EVENT_REF_SLUG = 'GITHUB_EVENT_REF_SLUG'; const GITHUB_EVENT_REF_SLUG_URL = 'GITHUB_EVENT_REF_SLUG_URL'; +/** + * Shorted outputs environments variables keys + */ +const GITHUB_SHA_SHORT = 'GITHUB_SHA_SHORT'; const GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT = 'GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT'; function run() { return __awaiter(this, void 0, void 0, function* () { @@ -128,11 +146,17 @@ function run() { core.exportVariable(GITHUB_EVENT_REF_SLUG_URL, slug_1.slugurlref(eventData.ref)); } else if (eventData.hasOwnProperty('pull_request')) { - core.exportVariable(GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT, slug_1.shortsha(eventData.pull_request.head.sha)); + core.exportVariable(GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT, short_1.shortsha(eventData.pull_request.head.sha)); } } + exportFirstPart(GITHUB_REPOSITORY, SEPARATOR, GITHUB_REPOSITORY_OWNER_PART); + exportSecondPart(GITHUB_REPOSITORY, SEPARATOR, GITHUB_REPOSITORY_NAME_PART); exportSlug(GITHUB_REPOSITORY, GITHUB_REPOSITORY_SLUG); + exportFirstPartSlug(GITHUB_REPOSITORY, SEPARATOR, GITHUB_REPOSITORY_OWNER_PART_SLUG); + exportSecondPartSlug(GITHUB_REPOSITORY, SEPARATOR, GITHUB_REPOSITORY_NAME_PART_SLUG); exportSlugUrl(GITHUB_REPOSITORY, GITHUB_REPOSITORY_SLUG_URL); + exportFirstPartSlugUrl(GITHUB_REPOSITORY, SEPARATOR, GITHUB_REPOSITORY_OWNER_PART_SLUG_URL); + exportSecondPartSlugUrl(GITHUB_REPOSITORY, SEPARATOR, GITHUB_REPOSITORY_NAME_PART_SLUG_URL); exportSlugRef(GITHUB_REF, GITHUB_REF_SLUG); exportSlugRef(GITHUB_HEAD_REF, GITHUB_HEAD_REF_SLUG); exportSlugRef(GITHUB_BASE_REF, GITHUB_BASE_REF_SLUG); @@ -146,12 +170,38 @@ function run() { } }); } +function exportFirstPart(inputKey, separator, outputKey) { + const envVar = process.env[inputKey]; + if (envVar) { + core.exportVariable(outputKey, partial_1.get_first_part(envVar, separator)); + } +} +function exportSecondPart(inputKey, separator, outputKey) { + const envVar = process.env[inputKey]; + if (envVar) { + core.exportVariable(outputKey, partial_1.get_second_part(envVar, separator)); + } +} function exportSlug(inputKey, outputKey) { const envVar = process.env[inputKey]; if (envVar) { core.exportVariable(outputKey, slug_1.slug(envVar)); } } +function exportFirstPartSlug(inputKey, separator, outputKey) { + const envVar = process.env[inputKey]; + if (envVar) { + const value = partial_1.get_first_part(envVar, separator); + core.exportVariable(outputKey, slug_1.slug(value)); + } +} +function exportSecondPartSlug(inputKey, separator, outputKey) { + const envVar = process.env[inputKey]; + if (envVar) { + const value = partial_1.get_second_part(envVar, separator); + core.exportVariable(outputKey, slug_1.slug(value)); + } +} function exportSlugRef(inputKey, outputKey) { const envVar = process.env[inputKey]; if (envVar) { @@ -164,6 +214,20 @@ function exportSlugUrl(inputKey, outputKey) { core.exportVariable(outputKey, slug_1.slugurl(envVar)); } } +function exportFirstPartSlugUrl(inputKey, separator, outputKey) { + const envVar = process.env[inputKey]; + if (envVar) { + const value = partial_1.get_first_part(envVar, separator); + core.exportVariable(outputKey, slug_1.slugurl(value)); + } +} +function exportSecondPartSlugUrl(inputKey, separator, outputKey) { + const envVar = process.env[inputKey]; + if (envVar) { + const value = partial_1.get_second_part(envVar, separator); + core.exportVariable(outputKey, slug_1.slugurl(value)); + } +} function exportSlugUrlRef(inputKey, outputKey) { const envVar = process.env[inputKey]; if (envVar) { @@ -173,7 +237,7 @@ function exportSlugUrlRef(inputKey, outputKey) { function exportShortSha(inputKey, outputKey) { const envVar = process.env[inputKey]; if (envVar) { - core.exportVariable(outputKey, slug_1.shortsha(envVar)); + core.exportVariable(outputKey, short_1.shortsha(envVar)); } } run(); @@ -424,6 +488,27 @@ function getState(name) { exports.getState = getState; //# sourceMappingURL=core.js.map +/***/ }), + +/***/ 213: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.shortsha = void 0; +const SHORT_SHA_SIZE = 8; +/** + * slug will take envVar and then : + * - limit the string size to 8 characters + * @param envVar to be slugged + */ +function shortsha(envVar) { + return envVar.substring(0, SHORT_SHA_SIZE); +} +exports.shortsha = shortsha; + + /***/ }), /***/ 278: @@ -536,6 +621,35 @@ function escapeProperty(s) { } //# sourceMappingURL=command.js.map +/***/ }), + +/***/ 373: +/***/ (function(__unusedmodule, exports) { + +"use strict"; + +Object.defineProperty(exports, "__esModule", { value: true }); +exports.get_second_part = exports.get_first_part = void 0; +/** + * Get the first part of envVar + * @param envVar to be split + * @param separator of the split + */ +function get_first_part(envVar, separator) { + return envVar.replace(RegExp(`${separator}.*$`), ''); +} +exports.get_first_part = get_first_part; +/** + * Get the second part of envVar + * @param envVar to be split + * @param separator of the split + */ +function get_second_part(envVar, separator) { + return envVar.replace(RegExp(`^.*${separator}`), ''); +} +exports.get_second_part = get_second_part; + + /***/ }), /***/ 565: @@ -544,9 +658,8 @@ function escapeProperty(s) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); -exports.shortsha = exports.slugurlref = exports.slugurl = exports.slugref = exports.slug = void 0; +exports.slugurlref = exports.slugurl = exports.slugref = exports.slug = void 0; const MAX_SLUG_STRING_SIZE = 63; -const SHORT_SHA_SIZE = 8; /** * slug will take envVar and then : * - put the variable content in lower case @@ -597,15 +710,6 @@ function slugurlref(envVar) { return slugurl(slugref(envVar)); } exports.slugurlref = slugurlref; -/** - * slug will take envVar and then : - * - limit the string size to 8 characters - * @param envVar to be slugged - */ -function shortsha(envVar) { - return envVar.substring(0, SHORT_SHA_SIZE); -} -exports.shortsha = shortsha; function trailHyphen(envVar) { return envVar.replace(RegExp('^-*', 'g'), '').replace(RegExp('-*$', 'g'), ''); } diff --git a/dist/index.js.map b/dist/index.js.map index 12875ab..5b01301 100644 --- a/dist/index.js.map +++ b/dist/index.js.map @@ -1 +1 @@ -{"version":3,"sources":["/webpack/bootstrap","../external \"os\"","../lib/main.js","../node_modules/@actions/core/lib/core.js","../node_modules/@actions/core/lib/utils.js","../node_modules/@actions/core/lib/command.js","../lib/slug.js","../external \"path\"","../node_modules/@actions/core/lib/file-command.js","../external \"fs\""],"names":[],"mappings":";;;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AC3CA,+B;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFA8DkF,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AC9D5E;AACb;AACA,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D,kBAAkB,mBAAO,CAAC,GAAW;AACrC,uBAAuB,mBAAO,CAAC,GAAgB;AAC/C,gBAAgB,mBAAO,CAAC,GAAS;AACjC,wBAAwB,mBAAO,CAAC,EAAI;AACpC,0BAA0B,mBAAO,CAAC,GAAM;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,aAAa,OAAO,cAAc,OAAO,cAAc;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,KAAK,IAAI,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU;AAChG;AACA;AACA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,6BAA6B,UAAU,EAAE,eAAe,EAAE,oBAAoB;AAC9E;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,sCAAsC;AAC3E;AACA,4DAA4D,KAAK;AACjE;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,KAAK;AACrC;AACA,OAAO;AACP,gC;;;;;;;;AC7Oa;AACb;AACA;AACA,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,iC;;;;;;;;AClBa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D,wBAAwB,mBAAO,CAAC,EAAI;AACpC,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,yBAAyB;AACzB;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,IAAI,GAAG,oBAAoB;AAChE;AACA;AACA;AACA;AACA,qBAAqB,WAAW,EAAE,yBAAyB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mC;;;;;;;;AC9Ea;AACb,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D,OAAO,YAAY,OAAO,cAAc,OAAO,WAAW,OAAO,WAAW,OAAO;AACnF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;AC3EA,iC;;;;;;;;ACAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D;AACA;AACA,wBAAwB,mBAAO,CAAC,GAAI;AACpC,wBAAwB,mBAAO,CAAC,EAAI;AACpC,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA,2CAA2C,QAAQ;AACnD;AACA,gFAAgF,QAAQ;AACxF;AACA;AACA,iDAAiD,SAAS;AAC1D;AACA,mCAAmC,gCAAgC,EAAE,OAAO;AAC5E;AACA,KAAK;AACL;AACA,OAAO;AACP,wC;;;;;;;AC5BA,+B","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tvar threw = true;\n \t\ttry {\n \t\t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n \t\t\tthrew = false;\n \t\t} finally {\n \t\t\tif(threw) delete installedModules[moduleId];\n \t\t}\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t__webpack_require__.ab = __dirname + \"/\";\n\n \t// the startup function\n \tfunction startup() {\n \t\t// Load entry module and return exports\n \t\treturn __webpack_require__(109);\n \t};\n\n \t// run startup\n \treturn startup();\n","module.exports = require(\"os\");",null,"\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst command_1 = require(\"./command\");\nconst file_command_1 = require(\"./file-command\");\nconst utils_1 = require(\"./utils\");\nconst os = __importStar(require(\"os\"));\nconst path = __importStar(require(\"path\"));\n/**\n * The code to exit an action\n */\nvar ExitCode;\n(function (ExitCode) {\n /**\n * A code indicating that the action was successful\n */\n ExitCode[ExitCode[\"Success\"] = 0] = \"Success\";\n /**\n * A code indicating that the action was a failure\n */\n ExitCode[ExitCode[\"Failure\"] = 1] = \"Failure\";\n})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));\n//-----------------------------------------------------------------------\n// Variables\n//-----------------------------------------------------------------------\n/**\n * Sets env variable for this action and future actions in the job\n * @param name the name of the variable to set\n * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction exportVariable(name, val) {\n const convertedVal = utils_1.toCommandValue(val);\n process.env[name] = convertedVal;\n const filePath = process.env['GITHUB_ENV'] || '';\n if (filePath) {\n const delimiter = '_GitHubActionsFileCommandDelimeter_';\n const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;\n file_command_1.issueCommand('ENV', commandValue);\n }\n else {\n command_1.issueCommand('set-env', { name }, convertedVal);\n }\n}\nexports.exportVariable = exportVariable;\n/**\n * Registers a secret which will get masked from logs\n * @param secret value of the secret\n */\nfunction setSecret(secret) {\n command_1.issueCommand('add-mask', {}, secret);\n}\nexports.setSecret = setSecret;\n/**\n * Prepends inputPath to the PATH (for this action and future actions)\n * @param inputPath\n */\nfunction addPath(inputPath) {\n const filePath = process.env['GITHUB_PATH'] || '';\n if (filePath) {\n file_command_1.issueCommand('PATH', inputPath);\n }\n else {\n command_1.issueCommand('add-path', {}, inputPath);\n }\n process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;\n}\nexports.addPath = addPath;\n/**\n * Gets the value of an input. The value is also trimmed.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string\n */\nfunction getInput(name, options) {\n const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';\n if (options && options.required && !val) {\n throw new Error(`Input required and not supplied: ${name}`);\n }\n return val.trim();\n}\nexports.getInput = getInput;\n/**\n * Sets the value of an output.\n *\n * @param name name of the output to set\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction setOutput(name, value) {\n command_1.issueCommand('set-output', { name }, value);\n}\nexports.setOutput = setOutput;\n/**\n * Enables or disables the echoing of commands into stdout for the rest of the step.\n * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.\n *\n */\nfunction setCommandEcho(enabled) {\n command_1.issue('echo', enabled ? 'on' : 'off');\n}\nexports.setCommandEcho = setCommandEcho;\n//-----------------------------------------------------------------------\n// Results\n//-----------------------------------------------------------------------\n/**\n * Sets the action status to failed.\n * When the action exits it will be with an exit code of 1\n * @param message add error issue message\n */\nfunction setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}\nexports.setFailed = setFailed;\n//-----------------------------------------------------------------------\n// Logging Commands\n//-----------------------------------------------------------------------\n/**\n * Gets whether Actions Step Debug is on or not\n */\nfunction isDebug() {\n return process.env['RUNNER_DEBUG'] === '1';\n}\nexports.isDebug = isDebug;\n/**\n * Writes debug message to user log\n * @param message debug message\n */\nfunction debug(message) {\n command_1.issueCommand('debug', {}, message);\n}\nexports.debug = debug;\n/**\n * Adds an error issue\n * @param message error issue message. Errors will be converted to string via toString()\n */\nfunction error(message) {\n command_1.issue('error', message instanceof Error ? message.toString() : message);\n}\nexports.error = error;\n/**\n * Adds an warning issue\n * @param message warning issue message. Errors will be converted to string via toString()\n */\nfunction warning(message) {\n command_1.issue('warning', message instanceof Error ? message.toString() : message);\n}\nexports.warning = warning;\n/**\n * Writes info to log with console.log.\n * @param message info message\n */\nfunction info(message) {\n process.stdout.write(message + os.EOL);\n}\nexports.info = info;\n/**\n * Begin an output group.\n *\n * Output until the next `groupEnd` will be foldable in this group\n *\n * @param name The name of the output group\n */\nfunction startGroup(name) {\n command_1.issue('group', name);\n}\nexports.startGroup = startGroup;\n/**\n * End an output group.\n */\nfunction endGroup() {\n command_1.issue('endgroup');\n}\nexports.endGroup = endGroup;\n/**\n * Wrap an asynchronous function call in a group.\n *\n * Returns the same type as the function itself.\n *\n * @param name The name of the group\n * @param fn The function to wrap in the group\n */\nfunction group(name, fn) {\n return __awaiter(this, void 0, void 0, function* () {\n startGroup(name);\n let result;\n try {\n result = yield fn();\n }\n finally {\n endGroup();\n }\n return result;\n });\n}\nexports.group = group;\n//-----------------------------------------------------------------------\n// Wrapper action state\n//-----------------------------------------------------------------------\n/**\n * Saves state for current action, the state can only be retrieved by this action's post job execution.\n *\n * @param name name of the state to store\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction saveState(name, value) {\n command_1.issueCommand('save-state', { name }, value);\n}\nexports.saveState = saveState;\n/**\n * Gets the value of an state set by this action's main execution.\n *\n * @param name name of the state to get\n * @returns string\n */\nfunction getState(name) {\n return process.env[`STATE_${name}`] || '';\n}\nexports.getState = getState;\n//# sourceMappingURL=core.js.map","\"use strict\";\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Sanitizes an input into a string so it can be passed into issueCommand safely\n * @param input input to sanitize into a string\n */\nfunction toCommandValue(input) {\n if (input === null || input === undefined) {\n return '';\n }\n else if (typeof input === 'string' || input instanceof String) {\n return input;\n }\n return JSON.stringify(input);\n}\nexports.toCommandValue = toCommandValue;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nfunction issueCommand(command, properties, message) {\n const cmd = new Command(command, properties, message);\n process.stdout.write(cmd.toString() + os.EOL);\n}\nexports.issueCommand = issueCommand;\nfunction issue(name, message = '') {\n issueCommand(name, {}, message);\n}\nexports.issue = issue;\nconst CMD_STRING = '::';\nclass Command {\n constructor(command, properties, message) {\n if (!command) {\n command = 'missing.command';\n }\n this.command = command;\n this.properties = properties;\n this.message = message;\n }\n toString() {\n let cmdStr = CMD_STRING + this.command;\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' ';\n let first = true;\n for (const key in this.properties) {\n if (this.properties.hasOwnProperty(key)) {\n const val = this.properties[key];\n if (val) {\n if (first) {\n first = false;\n }\n else {\n cmdStr += ',';\n }\n cmdStr += `${key}=${escapeProperty(val)}`;\n }\n }\n }\n }\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`;\n return cmdStr;\n }\n}\nfunction escapeData(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A');\n}\nfunction escapeProperty(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A')\n .replace(/:/g, '%3A')\n .replace(/,/g, '%2C');\n}\n//# sourceMappingURL=command.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.shortsha = exports.slugurlref = exports.slugurl = exports.slugref = exports.slug = void 0;\nconst MAX_SLUG_STRING_SIZE = 63;\nconst SHORT_SHA_SIZE = 8;\n/**\n * slug will take envVar and then :\n * - put the variable content in lower case\n * - replace any character by `-` except `0-9`, `a-z`, and `.`\n * - remove leading and trailing `-` character\n * - limit the string size to 63 characters\n * @param envVar to be slugged\n */\nfunction slug(envVar) {\n return trailHyphen(replaceAnyNonAlphanumericCaracter(envVar.toLowerCase())).substring(0, MAX_SLUG_STRING_SIZE);\n}\nexports.slug = slug;\n/**\n * slug will take envVar and then :\n * - remove refs/(heads|tags)/\n * - put the variable content in lower case\n * - replace any character by `-` except `0-9`, `a-z`, and `.`\n * - remove leading and trailing `-` character\n * - limit the string size to 63 characters\n * @param envVar to be slugged\n */\nfunction slugref(envVar) {\n return slug(removeRef(envVar.toLowerCase()));\n}\nexports.slugref = slugref;\n/**\n * slug will take envVar and then :\n * - put the variable content in lower case\n * - replace any character by `-` except `0-9`, `a-z`\n * - remove leading and trailing `-` character\n * - limit the string size to 63 characters\n * @param envVar to be slugged\n */\nfunction slugurl(envVar) {\n return slug(replaceAnyDotToHyphen(envVar));\n}\nexports.slugurl = slugurl;\n/**\n * slug will take envVar and then :\n * - remove refs/(heads|tags)/\n * - put the variable content in lower case\n * - replace any character by `-` except `0-9`, `a-z`\n * - remove leading and trailing `-` character\n * - limit the string size to 63 characters\n * @param envVar to be slugged\n */\nfunction slugurlref(envVar) {\n return slugurl(slugref(envVar));\n}\nexports.slugurlref = slugurlref;\n/**\n * slug will take envVar and then :\n * - limit the string size to 8 characters\n * @param envVar to be slugged\n */\nfunction shortsha(envVar) {\n return envVar.substring(0, SHORT_SHA_SIZE);\n}\nexports.shortsha = shortsha;\nfunction trailHyphen(envVar) {\n return envVar.replace(RegExp('^-*', 'g'), '').replace(RegExp('-*$', 'g'), '');\n}\nfunction replaceAnyNonAlphanumericCaracter(envVar) {\n return envVar.replace(RegExp('[^a-z0-9.]', 'g'), '-');\n}\nfunction replaceAnyDotToHyphen(envVar) {\n return envVar.replace(RegExp('[.]', 'g'), '-');\n}\nfunction removeRef(envVar) {\n return envVar.replace(RegExp('^refs/(heads|tags)/'), '');\n}\n","module.exports = require(\"path\");","\"use strict\";\n// For internal use, subject to change.\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst fs = __importStar(require(\"fs\"));\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\nfunction issueCommand(command, message) {\n const filePath = process.env[`GITHUB_${command}`];\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`);\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`);\n }\n fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n });\n}\nexports.issueCommand = issueCommand;\n//# sourceMappingURL=file-command.js.map","module.exports = require(\"fs\");"],"sourceRoot":""} \ No newline at end of file +{"version":3,"sources":["/webpack/bootstrap","../external \"os\"","../lib/main.js","../node_modules/@actions/core/lib/core.js","../lib/short.js","../node_modules/@actions/core/lib/utils.js","../node_modules/@actions/core/lib/command.js","../lib/partial.js","../lib/slug.js","../external \"path\"","../node_modules/@actions/core/lib/file-command.js","../external \"fs\""],"names":[],"mappings":";;;AAAA;AACA;;AAEA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAEA;AACA;AACA;AACA;AACA;AACA,YAAI;AACJ;AACA;;AAEA;AACA;;AAEA;AACA;AACA;;;AAGA;;AAEA;AACA;AACA;AACA;AACA;;AAEA;AACA;;;;;;;;AC3CA,+B;;;;;;;;ACAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kFAgFkF,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AChF5E;AACb;AACA,2BAA2B,+DAA+D,gBAAgB,EAAE,EAAE;AAC9G;AACA,mCAAmC,MAAM,6BAA6B,EAAE,YAAY,WAAW,EAAE;AACjG,kCAAkC,MAAM,iCAAiC,EAAE,YAAY,WAAW,EAAE;AACpG,+BAA+B,qFAAqF;AACpH;AACA,KAAK;AACL;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D,kBAAkB,mBAAO,CAAC,GAAW;AACrC,uBAAuB,mBAAO,CAAC,GAAgB;AAC/C,gBAAgB,mBAAO,CAAC,GAAS;AACjC,wBAAwB,mBAAO,CAAC,EAAI;AACpC,0BAA0B,mBAAO,CAAC,GAAM;AACxC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC,aAAa,OAAO,cAAc,OAAO,cAAc;AACxD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,KAAK,IAAI,UAAU,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,UAAU;AAChG;AACA;AACA;AACA,2CAA2C,OAAO;AAClD;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,yCAAyC;AACzC;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,6CAA6C;AAC7C;AACA,6BAA6B,UAAU,EAAE,eAAe,EAAE,oBAAoB;AAC9E;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,sCAAsC;AAC3E;AACA,4DAA4D,KAAK;AACjE;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA,sCAAsC;AACtC;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,KAAK;AACL;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,0CAA0C,OAAO;AACjD;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA,gCAAgC,KAAK;AACrC;AACA,OAAO;AACP,gC;;;;;;;;AC7Oa;AACb,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;;;;;;;;;ACZM;AACb;AACA;AACA,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP,iC;;;;;;;;AClBa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D,wBAAwB,mBAAO,CAAC,EAAI;AACpC,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA,yBAAyB;AACzB;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,qCAAqC,IAAI,GAAG,oBAAoB;AAChE;AACA;AACA;AACA;AACA,qBAAqB,WAAW,EAAE,yBAAyB;AAC3D;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,mC;;;;;;;;AC9Ea;AACb,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D,OAAO,mBAAmB,OAAO;AACjC;AACA;AACA;AACA;AACA;AACA;AACA,oCAAoC,UAAU;AAC9C;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA,uCAAuC,UAAU;AACjD;AACA,OAAO;;;;;;;;;ACpBM;AACb,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D,OAAO,cAAc,OAAO,WAAW,OAAO,WAAW,OAAO;AAChE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO;AACP;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;;;;;;ACjEA,iC;;;;;;;;ACAa;AACb;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,sBAAsB,OAAO,iBAAiB,cAAc;AAC5D;AACA;AACA,wBAAwB,mBAAO,CAAC,GAAI;AACpC,wBAAwB,mBAAO,CAAC,EAAI;AACpC,gBAAgB,mBAAO,CAAC,GAAS;AACjC;AACA,2CAA2C,QAAQ;AACnD;AACA,gFAAgF,QAAQ;AACxF;AACA;AACA,iDAAiD,SAAS;AAC1D;AACA,mCAAmC,gCAAgC,EAAE,OAAO;AAC5E;AACA,KAAK;AACL;AACA,OAAO;AACP,wC;;;;;;;AC5BA,+B","file":"index.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tvar threw = true;\n \t\ttry {\n \t\t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n \t\t\tthrew = false;\n \t\t} finally {\n \t\t\tif(threw) delete installedModules[moduleId];\n \t\t}\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t__webpack_require__.ab = __dirname + \"/\";\n\n \t// the startup function\n \tfunction startup() {\n \t\t// Load entry module and return exports\n \t\treturn __webpack_require__(109);\n \t};\n\n \t// run startup\n \treturn startup();\n","module.exports = require(\"os\");",null,"\"use strict\";\nvar __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {\n function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }\n return new (P || (P = Promise))(function (resolve, reject) {\n function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }\n function rejected(value) { try { step(generator[\"throw\"](value)); } catch (e) { reject(e); } }\n function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }\n step((generator = generator.apply(thisArg, _arguments || [])).next());\n });\n};\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst command_1 = require(\"./command\");\nconst file_command_1 = require(\"./file-command\");\nconst utils_1 = require(\"./utils\");\nconst os = __importStar(require(\"os\"));\nconst path = __importStar(require(\"path\"));\n/**\n * The code to exit an action\n */\nvar ExitCode;\n(function (ExitCode) {\n /**\n * A code indicating that the action was successful\n */\n ExitCode[ExitCode[\"Success\"] = 0] = \"Success\";\n /**\n * A code indicating that the action was a failure\n */\n ExitCode[ExitCode[\"Failure\"] = 1] = \"Failure\";\n})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));\n//-----------------------------------------------------------------------\n// Variables\n//-----------------------------------------------------------------------\n/**\n * Sets env variable for this action and future actions in the job\n * @param name the name of the variable to set\n * @param val the value of the variable. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction exportVariable(name, val) {\n const convertedVal = utils_1.toCommandValue(val);\n process.env[name] = convertedVal;\n const filePath = process.env['GITHUB_ENV'] || '';\n if (filePath) {\n const delimiter = '_GitHubActionsFileCommandDelimeter_';\n const commandValue = `${name}<<${delimiter}${os.EOL}${convertedVal}${os.EOL}${delimiter}`;\n file_command_1.issueCommand('ENV', commandValue);\n }\n else {\n command_1.issueCommand('set-env', { name }, convertedVal);\n }\n}\nexports.exportVariable = exportVariable;\n/**\n * Registers a secret which will get masked from logs\n * @param secret value of the secret\n */\nfunction setSecret(secret) {\n command_1.issueCommand('add-mask', {}, secret);\n}\nexports.setSecret = setSecret;\n/**\n * Prepends inputPath to the PATH (for this action and future actions)\n * @param inputPath\n */\nfunction addPath(inputPath) {\n const filePath = process.env['GITHUB_PATH'] || '';\n if (filePath) {\n file_command_1.issueCommand('PATH', inputPath);\n }\n else {\n command_1.issueCommand('add-path', {}, inputPath);\n }\n process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;\n}\nexports.addPath = addPath;\n/**\n * Gets the value of an input. The value is also trimmed.\n *\n * @param name name of the input to get\n * @param options optional. See InputOptions.\n * @returns string\n */\nfunction getInput(name, options) {\n const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';\n if (options && options.required && !val) {\n throw new Error(`Input required and not supplied: ${name}`);\n }\n return val.trim();\n}\nexports.getInput = getInput;\n/**\n * Sets the value of an output.\n *\n * @param name name of the output to set\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction setOutput(name, value) {\n command_1.issueCommand('set-output', { name }, value);\n}\nexports.setOutput = setOutput;\n/**\n * Enables or disables the echoing of commands into stdout for the rest of the step.\n * Echoing is disabled by default if ACTIONS_STEP_DEBUG is not set.\n *\n */\nfunction setCommandEcho(enabled) {\n command_1.issue('echo', enabled ? 'on' : 'off');\n}\nexports.setCommandEcho = setCommandEcho;\n//-----------------------------------------------------------------------\n// Results\n//-----------------------------------------------------------------------\n/**\n * Sets the action status to failed.\n * When the action exits it will be with an exit code of 1\n * @param message add error issue message\n */\nfunction setFailed(message) {\n process.exitCode = ExitCode.Failure;\n error(message);\n}\nexports.setFailed = setFailed;\n//-----------------------------------------------------------------------\n// Logging Commands\n//-----------------------------------------------------------------------\n/**\n * Gets whether Actions Step Debug is on or not\n */\nfunction isDebug() {\n return process.env['RUNNER_DEBUG'] === '1';\n}\nexports.isDebug = isDebug;\n/**\n * Writes debug message to user log\n * @param message debug message\n */\nfunction debug(message) {\n command_1.issueCommand('debug', {}, message);\n}\nexports.debug = debug;\n/**\n * Adds an error issue\n * @param message error issue message. Errors will be converted to string via toString()\n */\nfunction error(message) {\n command_1.issue('error', message instanceof Error ? message.toString() : message);\n}\nexports.error = error;\n/**\n * Adds an warning issue\n * @param message warning issue message. Errors will be converted to string via toString()\n */\nfunction warning(message) {\n command_1.issue('warning', message instanceof Error ? message.toString() : message);\n}\nexports.warning = warning;\n/**\n * Writes info to log with console.log.\n * @param message info message\n */\nfunction info(message) {\n process.stdout.write(message + os.EOL);\n}\nexports.info = info;\n/**\n * Begin an output group.\n *\n * Output until the next `groupEnd` will be foldable in this group\n *\n * @param name The name of the output group\n */\nfunction startGroup(name) {\n command_1.issue('group', name);\n}\nexports.startGroup = startGroup;\n/**\n * End an output group.\n */\nfunction endGroup() {\n command_1.issue('endgroup');\n}\nexports.endGroup = endGroup;\n/**\n * Wrap an asynchronous function call in a group.\n *\n * Returns the same type as the function itself.\n *\n * @param name The name of the group\n * @param fn The function to wrap in the group\n */\nfunction group(name, fn) {\n return __awaiter(this, void 0, void 0, function* () {\n startGroup(name);\n let result;\n try {\n result = yield fn();\n }\n finally {\n endGroup();\n }\n return result;\n });\n}\nexports.group = group;\n//-----------------------------------------------------------------------\n// Wrapper action state\n//-----------------------------------------------------------------------\n/**\n * Saves state for current action, the state can only be retrieved by this action's post job execution.\n *\n * @param name name of the state to store\n * @param value value to store. Non-string values will be converted to a string via JSON.stringify\n */\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\nfunction saveState(name, value) {\n command_1.issueCommand('save-state', { name }, value);\n}\nexports.saveState = saveState;\n/**\n * Gets the value of an state set by this action's main execution.\n *\n * @param name name of the state to get\n * @returns string\n */\nfunction getState(name) {\n return process.env[`STATE_${name}`] || '';\n}\nexports.getState = getState;\n//# sourceMappingURL=core.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.shortsha = void 0;\nconst SHORT_SHA_SIZE = 8;\n/**\n * slug will take envVar and then :\n * - limit the string size to 8 characters\n * @param envVar to be slugged\n */\nfunction shortsha(envVar) {\n return envVar.substring(0, SHORT_SHA_SIZE);\n}\nexports.shortsha = shortsha;\n","\"use strict\";\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Sanitizes an input into a string so it can be passed into issueCommand safely\n * @param input input to sanitize into a string\n */\nfunction toCommandValue(input) {\n if (input === null || input === undefined) {\n return '';\n }\n else if (typeof input === 'string' || input instanceof String) {\n return input;\n }\n return JSON.stringify(input);\n}\nexports.toCommandValue = toCommandValue;\n//# sourceMappingURL=utils.js.map","\"use strict\";\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\n/**\n * Commands\n *\n * Command Format:\n * ::name key=value,key=value::message\n *\n * Examples:\n * ::warning::This is the message\n * ::set-env name=MY_VAR::some value\n */\nfunction issueCommand(command, properties, message) {\n const cmd = new Command(command, properties, message);\n process.stdout.write(cmd.toString() + os.EOL);\n}\nexports.issueCommand = issueCommand;\nfunction issue(name, message = '') {\n issueCommand(name, {}, message);\n}\nexports.issue = issue;\nconst CMD_STRING = '::';\nclass Command {\n constructor(command, properties, message) {\n if (!command) {\n command = 'missing.command';\n }\n this.command = command;\n this.properties = properties;\n this.message = message;\n }\n toString() {\n let cmdStr = CMD_STRING + this.command;\n if (this.properties && Object.keys(this.properties).length > 0) {\n cmdStr += ' ';\n let first = true;\n for (const key in this.properties) {\n if (this.properties.hasOwnProperty(key)) {\n const val = this.properties[key];\n if (val) {\n if (first) {\n first = false;\n }\n else {\n cmdStr += ',';\n }\n cmdStr += `${key}=${escapeProperty(val)}`;\n }\n }\n }\n }\n cmdStr += `${CMD_STRING}${escapeData(this.message)}`;\n return cmdStr;\n }\n}\nfunction escapeData(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A');\n}\nfunction escapeProperty(s) {\n return utils_1.toCommandValue(s)\n .replace(/%/g, '%25')\n .replace(/\\r/g, '%0D')\n .replace(/\\n/g, '%0A')\n .replace(/:/g, '%3A')\n .replace(/,/g, '%2C');\n}\n//# sourceMappingURL=command.js.map","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.get_second_part = exports.get_first_part = void 0;\n/**\n * Get the first part of envVar\n * @param envVar to be split\n * @param separator of the split\n */\nfunction get_first_part(envVar, separator) {\n return envVar.replace(RegExp(`${separator}.*$`), '');\n}\nexports.get_first_part = get_first_part;\n/**\n * Get the second part of envVar\n * @param envVar to be split\n * @param separator of the split\n */\nfunction get_second_part(envVar, separator) {\n return envVar.replace(RegExp(`^.*${separator}`), '');\n}\nexports.get_second_part = get_second_part;\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.slugurlref = exports.slugurl = exports.slugref = exports.slug = void 0;\nconst MAX_SLUG_STRING_SIZE = 63;\n/**\n * slug will take envVar and then :\n * - put the variable content in lower case\n * - replace any character by `-` except `0-9`, `a-z`, and `.`\n * - remove leading and trailing `-` character\n * - limit the string size to 63 characters\n * @param envVar to be slugged\n */\nfunction slug(envVar) {\n return trailHyphen(replaceAnyNonAlphanumericCaracter(envVar.toLowerCase())).substring(0, MAX_SLUG_STRING_SIZE);\n}\nexports.slug = slug;\n/**\n * slug will take envVar and then :\n * - remove refs/(heads|tags)/\n * - put the variable content in lower case\n * - replace any character by `-` except `0-9`, `a-z`, and `.`\n * - remove leading and trailing `-` character\n * - limit the string size to 63 characters\n * @param envVar to be slugged\n */\nfunction slugref(envVar) {\n return slug(removeRef(envVar.toLowerCase()));\n}\nexports.slugref = slugref;\n/**\n * slug will take envVar and then :\n * - put the variable content in lower case\n * - replace any character by `-` except `0-9`, `a-z`\n * - remove leading and trailing `-` character\n * - limit the string size to 63 characters\n * @param envVar to be slugged\n */\nfunction slugurl(envVar) {\n return slug(replaceAnyDotToHyphen(envVar));\n}\nexports.slugurl = slugurl;\n/**\n * slug will take envVar and then :\n * - remove refs/(heads|tags)/\n * - put the variable content in lower case\n * - replace any character by `-` except `0-9`, `a-z`\n * - remove leading and trailing `-` character\n * - limit the string size to 63 characters\n * @param envVar to be slugged\n */\nfunction slugurlref(envVar) {\n return slugurl(slugref(envVar));\n}\nexports.slugurlref = slugurlref;\nfunction trailHyphen(envVar) {\n return envVar.replace(RegExp('^-*', 'g'), '').replace(RegExp('-*$', 'g'), '');\n}\nfunction replaceAnyNonAlphanumericCaracter(envVar) {\n return envVar.replace(RegExp('[^a-z0-9.]', 'g'), '-');\n}\nfunction replaceAnyDotToHyphen(envVar) {\n return envVar.replace(RegExp('[.]', 'g'), '-');\n}\nfunction removeRef(envVar) {\n return envVar.replace(RegExp('^refs/(heads|tags)/'), '');\n}\n","module.exports = require(\"path\");","\"use strict\";\n// For internal use, subject to change.\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];\n result[\"default\"] = mod;\n return result;\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\n// We use any as a valid input type\n/* eslint-disable @typescript-eslint/no-explicit-any */\nconst fs = __importStar(require(\"fs\"));\nconst os = __importStar(require(\"os\"));\nconst utils_1 = require(\"./utils\");\nfunction issueCommand(command, message) {\n const filePath = process.env[`GITHUB_${command}`];\n if (!filePath) {\n throw new Error(`Unable to find environment variable for file command ${command}`);\n }\n if (!fs.existsSync(filePath)) {\n throw new Error(`Missing file at path: ${filePath}`);\n }\n fs.appendFileSync(filePath, `${utils_1.toCommandValue(message)}${os.EOL}`, {\n encoding: 'utf8'\n });\n}\nexports.issueCommand = issueCommand;\n//# sourceMappingURL=file-command.js.map","module.exports = require(\"fs\");"],"sourceRoot":""} \ No newline at end of file diff --git a/docs/partial-variables.md b/docs/partial-variables.md new file mode 100644 index 0000000..e29bf8a --- /dev/null +++ b/docs/partial-variables.md @@ -0,0 +1,28 @@ +# Partial Variables + +## Table of Contents + +- [Partial Variables](#partial-variables) + - [Table of Contents](#table-of-contents) + - [GITHUB_REPOSITORY_OWNER_PART](#github_repository_owner_part) + - [GITHUB_REPOSITORY_NAME_PART](#github_repository_name_part) + +## GITHUB_REPOSITORY_OWNER_PART + +Owner part of the environment variable **GITHUB_REPOSITORY** + +| GITHUB_REPOSITORY | GITHUB_REPOSITORY_OWNER_PART | +| ---------------------------- | ---------------------------- | +| octocat/Hello-World | octocat | +| rlespinasse/Hello-World.go | rlespinasse | +| AnotherPerson/SomeRepository | AnotherPerson | + +## GITHUB_REPOSITORY_NAME_PART + +Repository name part of the environment variable **GITHUB_REPOSITORY** + +| GITHUB_REPOSITORY | GITHUB_REPOSITORY_NAME_PART | +| ---------------------------- | --------------------------- | +| octocat/Hello-World | Hello-World | +| rlespinasse/Hello-World.go | Hello-World.go | +| AnotherPerson/SomeRepository | SomeRepository | diff --git a/docs/slug-url-variables.md b/docs/slug-url-variables.md index ad6f004..8cbfbbd 100644 --- a/docs/slug-url-variables.md +++ b/docs/slug-url-variables.md @@ -5,6 +5,8 @@ - [Slug URL Variables](#slug-url-variables) - [Table of Contents](#table-of-contents) - [GITHUB_REPOSITORY_SLUG_URL](#github_repository_slug_url) + - [GITHUB_REPOSITORY_OWNER_PART_SLUG_URL](#github_repository_owner_part_slug_url) + - [GITHUB_REPOSITORY_NAME_PART_SLUG_URL](#github_repository_name_part_slug_url) - [GITHUB_REF_SLUG_URL](#github_ref_slug_url) - [GITHUB_HEAD_REF_SLUG_URL](#github_head_ref_slug_url) - [GITHUB_BASE_REF_SLUG_URL](#github_base_ref_slug_url) @@ -16,10 +18,35 @@ Slug URL the environment variable **GITHUB_REPOSITORY** The owner and repository name. -| GITHUB_REPOSITORY | GITHUB_REPOSITORY_SLUG_URL | -| -------------------------- | -------------------------- | -| octocat/Hello-World | octocat-hello-world | -| rlespinasse/Hello-World.go | rlespinasse-hello-world-go | +| GITHUB_REPOSITORY | GITHUB_REPOSITORY_SLUG_URL | +| ---------------------------- | ---------------------------- | +| octocat/Hello-World | octocat-hello-world | +| rlespinasse/Hello-World.go | rlespinasse-hello-world-go | +| AnotherPerson/SomeRepository | anotherperson-somerepository | + +## GITHUB_REPOSITORY_OWNER_PART_SLUG_URL + +Slug URL the environment variable [GITHUB_REPOSITORY_OWNER_PART](partial-variables.md#github_repository_owner_part) + +The Owner part of **GITHUB_REPOSITORY** variable. + +| GITHUB_REPOSITORY_OWNER_PART | GITHUB_REPOSITORY_OWNER_PART_SLUG_URL | +| ---------------------------- | ------------------------------------- | +| octocat | octocat | +| rlespinasse | rlespinasse | +| AnotherPerson | anotherperson | + +## GITHUB_REPOSITORY_NAME_PART_SLUG_URL + +Slug URL the environment variable [GITHUB_REPOSITORY_NAME_PART](partial-variables.md#github_repository_name_part) + +The Repository name part of **GITHUB_REPOSITORY** variable. + +| GITHUB_REPOSITORY_NAME_PART | GITHUB_REPOSITORY_NAME_PART_SLUG_URL | +| --------------------------- | ------------------------------------ | +| Hello-World | hello-world | +| Hello-World.go | hello-world-go | +| SomeRepository | somerepository | ## GITHUB_REF_SLUG_URL @@ -67,7 +94,7 @@ _Only set for forked repositories._ Slug URL the variable **github.event.ref** The git reference resource associated to triggered webhook. -_[Only set for `create`, and `delete` webhook events][4]._ +_Only set for [`create`, and `delete`][1] events._ | GITHUB_REF | GITHUB_HEAD_REF_SLUG_URL | | ------------------------------ | ------------------------ | diff --git a/docs/slug-variables.md b/docs/slug-variables.md index d07fad6..9bd52c9 100644 --- a/docs/slug-variables.md +++ b/docs/slug-variables.md @@ -5,6 +5,8 @@ - [Slug Variables](#slug-variables) - [Table of Contents](#table-of-contents) - [GITHUB_REPOSITORY_SLUG](#github_repository_slug) + - [GITHUB_REPOSITORY_OWNER_PART_SLUG](#github_repository_owner_part_slug) + - [GITHUB_REPOSITORY_NAME_PART_SLUG](#github_repository_name_part_slug) - [GITHUB_REF_SLUG](#github_ref_slug) - [GITHUB_HEAD_REF_SLUG](#github_head_ref_slug) - [GITHUB_BASE_REF_SLUG](#github_base_ref_slug) @@ -16,10 +18,35 @@ Slug the environment variable **GITHUB_REPOSITORY** The owner and repository name. -| GITHUB_REPOSITORY | GITHUB_REPOSITORY_SLUG | -| -------------------------- | -------------------------- | -| octocat/Hello-World | octocat-hello-world | -| rlespinasse/Hello-World.go | rlespinasse-hello-world.go | +| GITHUB_REPOSITORY | GITHUB_REPOSITORY_SLUG | +| ---------------------------- | ---------------------------- | +| octocat/Hello-World | octocat-hello-world | +| rlespinasse/Hello-World.go | rlespinasse-hello-world.go | +| AnotherPerson/SomeRepository | anotherperson-somerepository | + +## GITHUB_REPOSITORY_OWNER_PART_SLUG + +Slug the environment variable [GITHUB_REPOSITORY_OWNER_PART](partial-variables.md#github_repository_owner_part) + +The Owner part of **GITHUB_REPOSITORY** variable. + +| GITHUB_REPOSITORY_OWNER_PART | GITHUB_REPOSITORY_OWNER_PART_SLUG | +| ---------------------------- | --------------------------------- | +| octocat | octocat | +| rlespinasse | rlespinasse | +| AnotherPerson | anotherperson | + +## GITHUB_REPOSITORY_NAME_PART_SLUG + +Slug the environment variable [GITHUB_REPOSITORY_NAME_PART](partial-variables.md#github_repository_name_part) + +The Repository name part of **GITHUB_REPOSITORY** variable. + +| GITHUB_REPOSITORY_NAME_PART | GITHUB_REPOSITORY_NAME_PART_SLUG | +| --------------------------- | -------------------------------- | +| Hello-World | hello-world | +| Hello-World.go | hello-world.go | +| SomeRepository | somerepository | ## GITHUB_REF_SLUG @@ -41,7 +68,7 @@ _If neither a branch or tag is available for the event type, the variable will n Slug the environment variable **GITHUB_HEAD_REF** The branch of the head repository. -_Only set for forked repositories._ +_Only set for [`pull-request`][1] event and forked repositories._ | GITHUB_REF | GITHUB_HEAD_REF_SLUG | | ------------------------------ | -------------------- | @@ -54,7 +81,7 @@ _Only set for forked repositories._ Slug the environment variable **GITHUB_BASE_REF** The branch of the base repository. -_Only set for forked repositories._ +_Only set for [`pull-request`][1] event and forked repositories._ | GITHUB_REF | GITHUB_HEAD_REF_SLUG | | ------------------------------ | -------------------- | @@ -67,7 +94,7 @@ _Only set for forked repositories._ Slug the variable **github.event.ref** The git reference resource associated to triggered webhook. -_[Only set for `create`, and `delete` webhook events][4]._ +_Only set for [`create`, and `delete`][1] events._ | GITHUB_REF | GITHUB_HEAD_REF_SLUG | | ------------------------------ | -------------------- | diff --git a/examples/linux-usage.yml b/examples/linux-usage.yml index f9aa169..a15c09b 100644 --- a/examples/linux-usage.yml +++ b/examples/linux-usage.yml @@ -10,18 +10,25 @@ jobs: - uses: rlespinasse/github-slug-action@v3.x - name: Output run: | + echo "Partial variables" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART }}" echo "Slug variables" + echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG }}" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" echo " ref : ${{ env.GITHUB_REF_SLUG }}" echo " head ref : ${{ env.GITHUB_HEAD_REF_SLUG }}" echo " base ref : ${{ env.GITHUB_BASE_REF_SLUG }}" echo " event ref : ${{ env.GITHUB_EVENT_REF_SLUG }}" - echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG }}" echo "Slug URL variables" + echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL }}" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}" echo " ref : ${{ env.GITHUB_REF_SLUG_URL }}" echo " head ref : ${{ env.GITHUB_HEAD_REF_SLUG_URL }}" echo " base ref : ${{ env.GITHUB_BASE_REF_SLUG_URL }}" echo " event ref : ${{ env.GITHUB_EVENT_REF_SLUG_URL }}" - echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL }}" echo "Short SHA variables" echo " sha : ${{ env.GITHUB_SHA_SHORT }}" echo " pull request sha : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" diff --git a/examples/macos-usage.yml b/examples/macos-usage.yml index be0d8f0..0c98ed1 100644 --- a/examples/macos-usage.yml +++ b/examples/macos-usage.yml @@ -10,18 +10,25 @@ jobs: - uses: rlespinasse/github-slug-action@v3.x - name: Output run: | + echo "Partial variables" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART }}" echo "Slug variables" + echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG }}" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG }}" echo " ref : ${{ env.GITHUB_REF_SLUG }}" echo " head ref : ${{ env.GITHUB_HEAD_REF_SLUG }}" echo " base ref : ${{ env.GITHUB_BASE_REF_SLUG }}" echo " event ref : ${{ env.GITHUB_EVENT_REF_SLUG }}" - echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG }}" echo "Slug URL variables" + echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL }}" + echo " repository owner : ${{ env.GITHUB_REPOSITORY_OWNER_PART_SLUG_URL }}" + echo " repository name : ${{ env.GITHUB_REPOSITORY_NAME_PART_SLUG_URL }}" echo " ref : ${{ env.GITHUB_REF_SLUG_URL }}" echo " head ref : ${{ env.GITHUB_HEAD_REF_SLUG_URL }}" echo " base ref : ${{ env.GITHUB_BASE_REF_SLUG_URL }}" echo " event ref : ${{ env.GITHUB_EVENT_REF_SLUG_URL }}" - echo " repository : ${{ env.GITHUB_REPOSITORY_SLUG_URL }}" echo "Short SHA variables" echo " sha : ${{ env.GITHUB_SHA_SHORT }}" echo " pull request sha : ${{ env.GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT }}" diff --git a/examples/windows-usage.yml b/examples/windows-usage.yml index c984ce4..fab7878 100644 --- a/examples/windows-usage.yml +++ b/examples/windows-usage.yml @@ -10,18 +10,25 @@ jobs: - uses: rlespinasse/github-slug-action@v3.x - name: Output run: | + echo "Partial variables" + echo " repository owner : $env:GITHUB_REPOSITORY_OWNER_PART" + echo " repository name : $env:GITHUB_REPOSITORY_NAME_PART" echo "Slug variables" + echo " repository : $env:GITHUB_REPOSITORY_SLUG" + echo " repository owner : $env:GITHUB_REPOSITORY_OWNER_PART_SLUG" + echo " repository name : $env:GITHUB_REPOSITORY_NAME_PART_SLUG" echo " ref : $env:GITHUB_REF_SLUG" echo " head ref : $env:GITHUB_HEAD_REF_SLUG" echo " base ref : $env:GITHUB_BASE_REF_SLUG" echo " event ref : $env:GITHUB_EVENT_REF_SLUG" - echo " repository : $env:GITHUB_REPOSITORY_SLUG" echo "Slug URL variables" + echo " repository : $env:GITHUB_REPOSITORY_SLUG_URL" + echo " repository owner : $env:GITHUB_REPOSITORY_OWNER_PART_SLUG_URL" + echo " repository name : $env:GITHUB_REPOSITORY_NAME_PART_SLUG_URL" echo " ref : $env:GITHUB_REF_SLUG_URL" echo " head ref : $env:GITHUB_HEAD_REF_SLUG_URL" echo " base ref : $env:GITHUB_BASE_REF_SLUG_URL" echo " event ref : $env:GITHUB_EVENT_REF_SLUG_URL" - echo " repository : $env:GITHUB_REPOSITORY_SLUG_URL" echo "Short SHA variables" echo " sha : $env:GITHUB_SHA_SHORT" echo " pull request sha : $env:GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT" diff --git a/src/main.ts b/src/main.ts index 278f811..3522f41 100644 --- a/src/main.ts +++ b/src/main.ts @@ -1,5 +1,9 @@ import * as core from '@actions/core' -import {slugref, slug, slugurl, slugurlref, shortsha} from './slug' +import {slugref, slug, slugurl, slugurlref} from './slug' +import {shortsha} from './short' +import {get_first_part, get_second_part} from './partial' + +const SEPARATOR = '/' /** * Inputs environments variables keys from Github actions job @@ -12,20 +16,40 @@ const GITHUB_BASE_REF = 'GITHUB_BASE_REF' const GITHUB_SHA = 'GITHUB_SHA' const GITHUB_EVENT_PATH = 'GITHUB_EVENT_PATH' +/** + * Partial outputs environments variables keys + */ +const GITHUB_REPOSITORY_OWNER_PART = 'GITHUB_REPOSITORY_OWNER_PART' +const GITHUB_REPOSITORY_NAME_PART = 'GITHUB_REPOSITORY_NAME_PART' + /** * Slugged outputs environments variables keys */ const GITHUB_REPOSITORY_SLUG = 'GITHUB_REPOSITORY_SLUG' -const GITHUB_REPOSITORY_SLUG_URL = 'GITHUB_REPOSITORY_SLUG_URL' +const GITHUB_REPOSITORY_OWNER_PART_SLUG = 'GITHUB_REPOSITORY_OWNER_PART_SLUG' +const GITHUB_REPOSITORY_NAME_PART_SLUG = 'GITHUB_REPOSITORY_NAME_PART_SLUG' const GITHUB_REF_SLUG = 'GITHUB_REF_SLUG' const GITHUB_HEAD_REF_SLUG = 'GITHUB_HEAD_REF_SLUG' const GITHUB_BASE_REF_SLUG = 'GITHUB_BASE_REF_SLUG' +const GITHUB_EVENT_REF_SLUG = 'GITHUB_EVENT_REF_SLUG' + +/** + * URL-Slugged outputs environments variables keys + */ +const GITHUB_REPOSITORY_SLUG_URL = 'GITHUB_REPOSITORY_SLUG_URL' +const GITHUB_REPOSITORY_OWNER_PART_SLUG_URL = + 'GITHUB_REPOSITORY_OWNER_PART_SLUG_URL' +const GITHUB_REPOSITORY_NAME_PART_SLUG_URL = + 'GITHUB_REPOSITORY_NAME_PART_SLUG_URL' const GITHUB_REF_SLUG_URL = 'GITHUB_REF_SLUG_URL' const GITHUB_HEAD_REF_SLUG_URL = 'GITHUB_HEAD_REF_SLUG_URL' const GITHUB_BASE_REF_SLUG_URL = 'GITHUB_BASE_REF_SLUG_URL' -const GITHUB_SHA_SHORT = 'GITHUB_SHA_SHORT' -const GITHUB_EVENT_REF_SLUG = 'GITHUB_EVENT_REF_SLUG' const GITHUB_EVENT_REF_SLUG_URL = 'GITHUB_EVENT_REF_SLUG_URL' + +/** + * Shorted outputs environments variables keys + */ +const GITHUB_SHA_SHORT = 'GITHUB_SHA_SHORT' const GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT = 'GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT' @@ -48,9 +72,32 @@ async function run(): Promise { } } + exportFirstPart(GITHUB_REPOSITORY, SEPARATOR, GITHUB_REPOSITORY_OWNER_PART) + exportSecondPart(GITHUB_REPOSITORY, SEPARATOR, GITHUB_REPOSITORY_NAME_PART) + exportSlug(GITHUB_REPOSITORY, GITHUB_REPOSITORY_SLUG) + exportFirstPartSlug( + GITHUB_REPOSITORY, + SEPARATOR, + GITHUB_REPOSITORY_OWNER_PART_SLUG + ) + exportSecondPartSlug( + GITHUB_REPOSITORY, + SEPARATOR, + GITHUB_REPOSITORY_NAME_PART_SLUG + ) exportSlugUrl(GITHUB_REPOSITORY, GITHUB_REPOSITORY_SLUG_URL) + exportFirstPartSlugUrl( + GITHUB_REPOSITORY, + SEPARATOR, + GITHUB_REPOSITORY_OWNER_PART_SLUG_URL + ) + exportSecondPartSlugUrl( + GITHUB_REPOSITORY, + SEPARATOR, + GITHUB_REPOSITORY_NAME_PART_SLUG_URL + ) exportSlugRef(GITHUB_REF, GITHUB_REF_SLUG) exportSlugRef(GITHUB_HEAD_REF, GITHUB_HEAD_REF_SLUG) @@ -66,6 +113,28 @@ async function run(): Promise { } } +function exportFirstPart( + inputKey: string, + separator: string, + outputKey: string +): void { + const envVar = process.env[inputKey] + if (envVar) { + core.exportVariable(outputKey, get_first_part(envVar, separator)) + } +} + +function exportSecondPart( + inputKey: string, + separator: string, + outputKey: string +): void { + const envVar = process.env[inputKey] + if (envVar) { + core.exportVariable(outputKey, get_second_part(envVar, separator)) + } +} + function exportSlug(inputKey: string, outputKey: string): void { const envVar = process.env[inputKey] if (envVar) { @@ -73,6 +142,30 @@ function exportSlug(inputKey: string, outputKey: string): void { } } +function exportFirstPartSlug( + inputKey: string, + separator: string, + outputKey: string +): void { + const envVar = process.env[inputKey] + if (envVar) { + const value = get_first_part(envVar, separator) + core.exportVariable(outputKey, slug(value)) + } +} + +function exportSecondPartSlug( + inputKey: string, + separator: string, + outputKey: string +): void { + const envVar = process.env[inputKey] + if (envVar) { + const value = get_second_part(envVar, separator) + core.exportVariable(outputKey, slug(value)) + } +} + function exportSlugRef(inputKey: string, outputKey: string): void { const envVar = process.env[inputKey] if (envVar) { @@ -87,6 +180,30 @@ function exportSlugUrl(inputKey: string, outputKey: string): void { } } +function exportFirstPartSlugUrl( + inputKey: string, + separator: string, + outputKey: string +): void { + const envVar = process.env[inputKey] + if (envVar) { + const value = get_first_part(envVar, separator) + core.exportVariable(outputKey, slugurl(value)) + } +} + +function exportSecondPartSlugUrl( + inputKey: string, + separator: string, + outputKey: string +): void { + const envVar = process.env[inputKey] + if (envVar) { + const value = get_second_part(envVar, separator) + core.exportVariable(outputKey, slugurl(value)) + } +} + function exportSlugUrlRef(inputKey: string, outputKey: string): void { const envVar = process.env[inputKey] if (envVar) { diff --git a/src/partial.ts b/src/partial.ts new file mode 100644 index 0000000..0495a07 --- /dev/null +++ b/src/partial.ts @@ -0,0 +1,17 @@ +/** + * Get the first part of envVar + * @param envVar to be split + * @param separator of the split + */ +export function get_first_part(envVar: string, separator: string): string { + return envVar.replace(RegExp(`${separator}.*$`), '') +} + +/** + * Get the second part of envVar + * @param envVar to be split + * @param separator of the split + */ +export function get_second_part(envVar: string, separator: string): string { + return envVar.replace(RegExp(`^.*${separator}`), '') +} diff --git a/src/short.ts b/src/short.ts new file mode 100644 index 0000000..bca2ed7 --- /dev/null +++ b/src/short.ts @@ -0,0 +1,10 @@ +const SHORT_SHA_SIZE = 8 + +/** + * slug will take envVar and then : + * - limit the string size to 8 characters + * @param envVar to be slugged + */ +export function shortsha(envVar: string): string { + return envVar.substring(0, SHORT_SHA_SIZE) +} diff --git a/src/slug.ts b/src/slug.ts index 0f66491..52a2ead 100644 --- a/src/slug.ts +++ b/src/slug.ts @@ -1,5 +1,4 @@ const MAX_SLUG_STRING_SIZE = 63 -const SHORT_SHA_SIZE = 8 /** * slug will take envVar and then : @@ -53,15 +52,6 @@ export function slugurlref(envVar: string): string { return slugurl(slugref(envVar)) } -/** - * slug will take envVar and then : - * - limit the string size to 8 characters - * @param envVar to be slugged - */ -export function shortsha(envVar: string): string { - return envVar.substring(0, SHORT_SHA_SIZE) -} - function trailHyphen(envVar: string): string { return envVar.replace(RegExp('^-*', 'g'), '').replace(RegExp('-*$', 'g'), '') }