diff --git a/README.md b/README.md index 27d924c..4646f81 100644 --- a/README.md +++ b/README.md @@ -5,128 +5,85 @@ [![Public workflows that use this action.][8]][9] [![Licence][11]][12] -This GitHub Action will expose the slug value of all [GitHub environment variables][10] inside your GitHub workflow. +This GitHub Action will expose the slug/short values of [some GitHub environment variables][10] inside your GitHub workflow. -`Slug` a variable will +## Table of Contents + +- [GitHub Slug action](#github-slug-action) + - [Table of Contents](#table-of-contents) + - [Overview](#overview) + - [Use this action](#use-this-action) + - [Available Environment variables](#available-environment-variables) + - [Slug variables](#slug-variables) + - [Slug URL variables](#slug-url-variables) + - [Short variables](#short-variables) + - [Contribute](#contribute) + - [Troubleshooting](#troubleshooting) + - [An action could not be found at the URI](#an-action-could-not-be-found-at-the-uri) + - [Thanks for talking about us](#thanks-for-talking-about-us) + +## Overview + +`SLUG` a variable will - put the variable content in lower case - replace any character by `-` except `0-9`, `a-z`, and `.` - remove leading and trailing `-` character - limit the string size to 63 characters -Others `Slug`-ish commands are available: +
+ Others Slug-ish commands are available +

-- `Slug URL` a variable will be like the `slug` variable but the `.` character will also be replaced by `-` -- `Short SHA` a variable will limit the string size to 8 characters +- `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) -## Exposed GitHub environment variables +

+
+ +## Use this action + +Add this in your workflow ```yaml - name: Inject slug/short variables uses: rlespinasse/github-slug-action@v3.x - -- name: Print slug/short variables - run: | - echo "Slug variables" - 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 " 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 }}" ``` -Read [default environment variables][3] page for more information. +Check for more [examples][3] (OS usage, URL use, ...) -**TIP:** Use [Dependabot][14] to maintain your `github-slug-action` version updated in your GitHub workflows. +**Tip:** Use [Dependabot][14] to maintain your `github-slug-action` version updated in your GitHub workflows. -### GITHUB_REF_SLUG / GITHUB_REF_SLUG_URL +## Available Environment variables -Slug the environment variable **GITHUB_REF** +**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]. -The branch or tag ref that triggered the workflow. -_If neither a branch or tag is available for the event type, the variable will not exist._ +### Slug variables -| GITHUB_REF | GITHUB_REF_SLUG | GITHUB_REF_SLUG_URL | -| ------------------------------ | ------------------- | ------------------- | -| refs/heads/master | master | master | -| refs/heads/feat/new_feature | feat-new-feature | feat-new-feature | -| refs/tags/v1.0.0 | v1.0.0 | v1-0-0 | -| refs/tags/product@1.0.0-rc.2 | product-1.0.0-rc.2 | product-1-0-0-rc-2 | -| refs/heads/New_Awesome_Product | new-awesome-product | new-awesome-product | +| 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 `create`, and `delete` webhook events][4]. | -> **NOTE :** -> GITHUB_REF_SLUG_URL is design to be used as subdomain in an URL. +### Slug URL variables -_Additional variables (only set for forked repositories) :_ +| 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 `create`, and `delete` webhook events][4]. | -- `GITHUB_HEAD_REF_SLUG`/`GITHUB_HEAD_REF_SLUG_URL`, The branch of the head repository **GITHUB_HEAD_REF** -- `GITHUB_BASE_REF_SLUG`/`GITHUB_BASE_REF_SLUG_URL`, The branch of the base repository **GITHUB_BASE_REF** +### Short variables -_Additional variables (only set for [create][4], and [delete][5] webhook events with `ref` data) :_ - -- `GITHUB_EVENT_REF_SLUG`/`GITHUB_EVENT_REF_SLUG_URL`, The git reference resource associated to the webhook. - -### GITHUB_REPOSITORY_SLUG / GITHUB_REPOSITORY_SLUG_URL - -Slug the environment variable **GITHUB_REPOSITORY** - -The owner and repository name. - -| GITHUB_REPOSITORY | GITHUB_REPOSITORY_SLUG | GITHUB_REPOSITORY_SLUG_URL | -| -------------------------- | -------------------------- | -------------------------- | -| octocat/Hello-World | octocat-hello-world | octocat-hello-world | -| rlespinasse/Hello-World.go | rlespinasse-hello-world.go | rlespinasse-hello-world-go | - -> **NOTE :** -> GITHUB_REPOSITORY_SLUG_URL is design to be used as subdomain in an URL. - -### GITHUB_SHA_SHORT - -Short the environment variable **GITHUB_SHA** - -The commit SHA that triggered the workflow - -| GITHUB_SHA | GITHUB_SHA_SHORT | -| ---------------------------------------- | ---------------- | -| ffac537e6cbbf934b08745a378932722df287a53 | ffac537e | - -### GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT - -Short the value of `github.event.pull_request.head.sha` that represents the last commit -used for triggering an action for a pull request. - -| github.event.pull_request.head.sha | GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT | -| ---------------------------------------- | ---------------------------------------- | -| ffac537e6cbbf934b08745a378932722df287a53 | ffac537e | - -### Use slug variable in an URL - -In an URL, use `_SLUG_URL` instead of **\_SLUG** as subdomain to be compliant. - -> **NOTE :** -> \_SLUG can be used in an URL only as part of the \_resource path*. - -```yaml -- name: Inject slug/short variables - uses: rlespinasse/github-slug-action@v3.x - -- name: Deploy dummy application using slug in the 'subdomain' part - run: | - ./deploy-application.sh --url "https://${{ env._SLUG_URL }}.staging.app.mycompany.com" - -- name: Deploy dummy application using slug in the 'resource path' part - run: | - ./deploy-application.sh --url "https://staging.app.mycompany.com/${{ env._SLUG }}" -``` +| Variable | Short version of | Description | +| ------------------------------------------------------------------------------------------------------------ | ------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | +| [GITHUB_SHA_SHORT](docs/short-variables.md#GITHUB_SHA_SHORT) | GITHUB_SHA | The commit SHA that triggered the workflow. | +| [GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT](docs/short-variables.md#GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT) | _github.event.pull_request.head.sha_ | The commit SHA on pull request that trigger workflow.
[Only set for `pull_request`, `pull_request_review`, `pull_request_review_comment`, and `pull_request_target` webhook events][4]. | ## Contribute @@ -134,7 +91,7 @@ Follow [Developers guide](DEVELOPERS.md) ## Troubleshooting -### Missing master branch +### An action could not be found at the URI If your workflow fail on the `Set up job` task with this kind of log : @@ -143,12 +100,12 @@ Download action repository 'rlespinasse/github-slug-action@master' ##[error]An action could not be found at the URI 'https://api.github.com/repos/rlespinasse/github-slug-action/tarball/master' ``` -Please, use the current branch `v3.x` or a version tag (see [releases pages][6]) in order to fix your workflow. - > The master branch don't exists anymore. > > The master branch EOL have been set to **2020-10-25** after a 6-month deprecation period (more information on the [EOL issue][7]) +Please, use the current branch `v3.x` or a version tag (see [releases pages][6]) in order to fix your workflow. + ## Thanks for talking about us - [Mettre en place une CI/CD Angular avec GitHub Actions & Netlify][15] (in french :fr:) @@ -157,9 +114,9 @@ Please, use the current branch `v3.x` or a version tag (see [releases pages][6]) [1]: https://github.com/rlespinasse/github-slug-action/workflows/Build/badge.svg [2]: https://github.com/rlespinasse/github-slug-action/actions -[3]: https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables -[4]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#create -[5]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#delete +[3]: https://github.com/rlespinasse/github-slug-action/tree/v3.x/examples +[4]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads +[5]: https://github.com/rlespinasse/github-slug-action/issues/new?assignees=&labels=enhancement&template=feature_request.md&title= [6]: https://github.com/rlespinasse/github-slug-action/releases [7]: https://github.com/rlespinasse/github-slug-action/issues/15 [8]: https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-git-master.endbug.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3Drlespinasse%2Fgithub-slug-action%26badge%3Dtrue @@ -171,3 +128,5 @@ Please, use the current branch `v3.x` or a version tag (see [releases pages][6]) [14]: https://docs.github.com/en/free-pro-team@latest/github/administering-a-repository/keeping-your-actions-up-to-date-with-github-dependabot [15]: https://esensconsulting.medium.com/mettre-en-place-une-ci-cd-angular-avec-github-actions-netlify-ca0b59b99ed8 [16]: https://www.youtube.com/watch?v=RHnTJBwcE98 +[17]: +https://docs.github.com/en/actions/reference/environment-variables#naming-conventions-for-environment-variables diff --git a/dist/index.js.map b/dist/index.js.map index 2872c90..12875ab 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\";\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.shortsha = exports.slugurlref = exports.slugurl = exports.slugref = exports.slug = void 0;\r\nconst MAX_SLUG_STRING_SIZE = 63;\r\nconst SHORT_SHA_SIZE = 8;\r\n/**\r\n * slug will take envVar and then :\r\n * - put the variable content in lower case\r\n * - replace any character by `-` except `0-9`, `a-z`, and `.`\r\n * - remove leading and trailing `-` character\r\n * - limit the string size to 63 characters\r\n * @param envVar to be slugged\r\n */\r\nfunction slug(envVar) {\r\n return trailHyphen(replaceAnyNonAlphanumericCaracter(envVar.toLowerCase())).substring(0, MAX_SLUG_STRING_SIZE);\r\n}\r\nexports.slug = slug;\r\n/**\r\n * slug will take envVar and then :\r\n * - remove refs/(heads|tags)/\r\n * - put the variable content in lower case\r\n * - replace any character by `-` except `0-9`, `a-z`, and `.`\r\n * - remove leading and trailing `-` character\r\n * - limit the string size to 63 characters\r\n * @param envVar to be slugged\r\n */\r\nfunction slugref(envVar) {\r\n return slug(removeRef(envVar.toLowerCase()));\r\n}\r\nexports.slugref = slugref;\r\n/**\r\n * slug will take envVar and then :\r\n * - put the variable content in lower case\r\n * - replace any character by `-` except `0-9`, `a-z`\r\n * - remove leading and trailing `-` character\r\n * - limit the string size to 63 characters\r\n * @param envVar to be slugged\r\n */\r\nfunction slugurl(envVar) {\r\n return slug(replaceAnyDotToHyphen(envVar));\r\n}\r\nexports.slugurl = slugurl;\r\n/**\r\n * slug will take envVar and then :\r\n * - remove refs/(heads|tags)/\r\n * - put the variable content in lower case\r\n * - replace any character by `-` except `0-9`, `a-z`\r\n * - remove leading and trailing `-` character\r\n * - limit the string size to 63 characters\r\n * @param envVar to be slugged\r\n */\r\nfunction slugurlref(envVar) {\r\n return slugurl(slugref(envVar));\r\n}\r\nexports.slugurlref = slugurlref;\r\n/**\r\n * slug will take envVar and then :\r\n * - limit the string size to 8 characters\r\n * @param envVar to be slugged\r\n */\r\nfunction shortsha(envVar) {\r\n return envVar.substring(0, SHORT_SHA_SIZE);\r\n}\r\nexports.shortsha = shortsha;\r\nfunction trailHyphen(envVar) {\r\n return envVar.replace(RegExp('^-*', 'g'), '').replace(RegExp('-*$', 'g'), '');\r\n}\r\nfunction replaceAnyNonAlphanumericCaracter(envVar) {\r\n return envVar.replace(RegExp('[^a-z0-9.]', 'g'), '-');\r\n}\r\nfunction replaceAnyDotToHyphen(envVar) {\r\n return envVar.replace(RegExp('[.]', 'g'), '-');\r\n}\r\nfunction removeRef(envVar) {\r\n return envVar.replace(RegExp('^refs/(heads|tags)/'), '');\r\n}\r\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","../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 diff --git a/docs/github-variables.md b/docs/github-variables.md new file mode 100644 index 0000000..36cfb01 --- /dev/null +++ b/docs/github-variables.md @@ -0,0 +1,96 @@ +# Available GitHub Variables + +All `GitHub` variables availables in your workflow in addition of ones exposed by this Action + +## Table of Contents + +- [Available GitHub Variables](#available-github-variables) + - [Table of Contents](#table-of-contents) + - [Default environment variables](#default-environment-variables) + - [Action-managed Environment Variables](#action-managed-environment-variables) + - [Variables from events](#variables-from-events) + - [Action-managed Event Variables](#action-managed-event-variables) + - [create](#create) + - [delete](#delete) + - [pull_request](#pull_request) + - [pull_request_review](#pull_request_review) + - [pull_request_review_comment](#pull_request_review_comment) + - [pull_request_target](#pull_request_target) + +## Default environment variables + +Read the official documentation about [Default environment variables][1]. + +### Action-managed Environment Variables + +| Action-managed Variables | Can be suffix by | +| ------------------------ | -------------------- | +| GITHUB_REPOSITORY | `_SLUG`, `_SLUG_URL` | +| GITHUB_REF | `_SLUG`, `_SLUG_URL` | +| GITHUB_HEAD_REF | `_SLUG`, `_SLUG_URL` | +| GITHUB_BASE_REF | `_SLUG`, `_SLUG_URL` | +| GITHUB_SHA | `_SHORT` | + +## Variables from events + +Read the official documentation about [Events that trigger workflows][2]. + +### Action-managed Event Variables + +#### create + +Checkout [create][3] webhook payload content + +| Action-managed Variables | Available as | +| ------------------------ | ------------------------- | +| github.event.ref | GITHUB_EVENT_REF_SLUG | +| github.event.ref | GITHUB_EVENT_REF_SLUG_URL | + +#### delete + +Checkout [delete][4] webhook payload content + +| Action-managed Variables | Available as | +| ------------------------ | ------------------------- | +| github.event.ref | GITHUB_EVENT_REF_SLUG | +| github.event.ref | GITHUB_EVENT_REF_SLUG_URL | + +#### pull_request + +Checkout [pull_request][5] webhook payload content + +| Action-managed Variables | Available as | +| ---------------------------------- | ---------------------------------------- | +| github.event.pull_request.head.sha | GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT | + +#### pull_request_review + +Checkout [pull_request_review][6] webhook payload content + +| Action-managed Variables | Available as | +| ---------------------------------- | ---------------------------------------- | +| github.event.pull_request.head.sha | GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT | + +#### pull_request_review_comment + +Checkout [pull_request_review_comment][7] webhook payload content + +| Action-managed Variables | Available as | +| ---------------------------------- | ---------------------------------------- | +| github.event.pull_request.head.sha | GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT | + +#### pull_request_target + +Checkout [pull_request][5] webhook payload content + +| Action-managed Variables | Available as | +| ---------------------------------- | ---------------------------------------- | +| github.event.pull_request.head.sha | GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT | + +[1]: https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables +[2]: https://docs.github.com/en/actions/reference/events-that-trigger-workflows +[3]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#create +[4]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#delete +[5]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request +[6]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review +[7]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads#pull_request_review_comment diff --git a/docs/short-variables.md b/docs/short-variables.md new file mode 100644 index 0000000..e42df1c --- /dev/null +++ b/docs/short-variables.md @@ -0,0 +1,27 @@ +# Short Variables + +## Table of Contents + +- [Short Variables](#short-variables) + - [Table of Contents](#table-of-contents) + - [GITHUB_SHA_SHORT](#github_sha_short) + - [GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT](#github_event_pull_request_head_sha_short) + +## GITHUB_SHA_SHORT + +Short the environment variable **GITHUB_SHA** + +The commit SHA that triggered the workflow + +| GITHUB_SHA | GITHUB_SHA_SHORT | +| ---------------------------------------- | ---------------- | +| ffac537e6cbbf934b08745a378932722df287a53 | ffac537e | + +## GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT + +Short the value of `github.event.pull_request.head.sha` that represents the last commit +used for triggering an action for a pull request. + +| github.event.pull_request.head.sha | GITHUB_EVENT_PULL_REQUEST_HEAD_SHA_SHORT | +| ---------------------------------------- | ---------------------------------------- | +| ffac537e6cbbf934b08745a378932722df287a53 | ffac537e | diff --git a/docs/slug-url-variables.md b/docs/slug-url-variables.md new file mode 100644 index 0000000..ad6f004 --- /dev/null +++ b/docs/slug-url-variables.md @@ -0,0 +1,78 @@ +# Slug URL Variables + +## Table of Contents + +- [Slug URL Variables](#slug-url-variables) + - [Table of Contents](#table-of-contents) + - [GITHUB_REPOSITORY_SLUG_URL](#github_repository_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) + - [GITHUB_EVENT_REF_SLUG_URL](#github_event_ref_slug_url) + +## GITHUB_REPOSITORY_SLUG_URL + +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_REF_SLUG_URL + +Slug URL the environment variable **GITHUB_REF** + +The branch or tag ref that triggered the workflow. +_If neither a branch or tag is available for the event type, the variable will not exist._ + +| GITHUB_REF | GITHUB_REF_SLUG_URL | +| ------------------------------ | ------------------- | +| refs/heads/main | main | +| refs/heads/feat/new_feature | feat-new-feature | +| refs/tags/v1.0.0 | v1-0-0 | +| refs/tags/product@1.0.0-rc.2 | product-1-0-0-rc-2 | +| refs/heads/New_Awesome_Product | new-awesome-product | + +## GITHUB_HEAD_REF_SLUG_URL + +Slug URL the environment variable **GITHUB_HEAD_REF** + +The branch of the head repository. +_Only set for forked repositories._ + +| GITHUB_REF | GITHUB_HEAD_REF_SLUG_URL | +| ------------------------------ | ------------------------ | +| refs/heads/main | main | +| refs/heads/feat/new_feature | feat-new-feature | +| refs/heads/New_Awesome_Product | new-awesome-product | + +## GITHUB_BASE_REF_SLUG_URL + +Slug URL the environment variable **GITHUB_BASE_REF** + +The branch of the base repository. +_Only set for forked repositories._ + +| GITHUB_REF | GITHUB_HEAD_REF_SLUG_URL | +| ------------------------------ | ------------------------ | +| refs/heads/main | main | +| refs/heads/feat/new_feature | feat-new-feature | +| refs/heads/New_Awesome_Product | new-awesome-product | + +## GITHUB_EVENT_REF_SLUG_URL + +Slug URL the variable **github.event.ref** + +The git reference resource associated to triggered webhook. +_[Only set for `create`, and `delete` webhook events][4]._ + +| GITHUB_REF | GITHUB_HEAD_REF_SLUG_URL | +| ------------------------------ | ------------------------ | +| refs/heads/main | main | +| refs/heads/feat/new_feature | feat-new-feature | +| refs/heads/New_Awesome_Product | new-awesome-product | + +[1]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads diff --git a/docs/slug-variables.md b/docs/slug-variables.md new file mode 100644 index 0000000..d07fad6 --- /dev/null +++ b/docs/slug-variables.md @@ -0,0 +1,78 @@ +# Slug Variables + +## Table of Contents + +- [Slug Variables](#slug-variables) + - [Table of Contents](#table-of-contents) + - [GITHUB_REPOSITORY_SLUG](#github_repository_slug) + - [GITHUB_REF_SLUG](#github_ref_slug) + - [GITHUB_HEAD_REF_SLUG](#github_head_ref_slug) + - [GITHUB_BASE_REF_SLUG](#github_base_ref_slug) + - [GITHUB_EVENT_REF_SLUG](#github_event_ref_slug) + +## GITHUB_REPOSITORY_SLUG + +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_REF_SLUG + +Slug the environment variable **GITHUB_REF** + +The branch or tag ref that triggered the workflow. +_If neither a branch or tag is available for the event type, the variable will not exist._ + +| GITHUB_REF | GITHUB_REF_SLUG | +| ------------------------------ | ------------------- | +| refs/heads/main | main | +| refs/heads/feat/new_feature | feat-new-feature | +| refs/tags/v1.0.0 | v1.0.0 | +| refs/tags/product@1.0.0-rc.2 | product-1.0.0-rc.2 | +| refs/heads/New_Awesome_Product | new-awesome-product | + +## GITHUB_HEAD_REF_SLUG + +Slug the environment variable **GITHUB_HEAD_REF** + +The branch of the head repository. +_Only set for forked repositories._ + +| GITHUB_REF | GITHUB_HEAD_REF_SLUG | +| ------------------------------ | -------------------- | +| refs/heads/main | main | +| refs/heads/feat/new_feature | feat-new-feature | +| refs/heads/New_Awesome_Product | new-awesome-product | + +## GITHUB_BASE_REF_SLUG + +Slug the environment variable **GITHUB_BASE_REF** + +The branch of the base repository. +_Only set for forked repositories._ + +| GITHUB_REF | GITHUB_HEAD_REF_SLUG | +| ------------------------------ | -------------------- | +| refs/heads/main | main | +| refs/heads/feat/new_feature | feat-new-feature | +| refs/heads/New_Awesome_Product | new-awesome-product | + +## GITHUB_EVENT_REF_SLUG + +Slug the variable **github.event.ref** + +The git reference resource associated to triggered webhook. +_[Only set for `create`, and `delete` webhook events][4]._ + +| GITHUB_REF | GITHUB_HEAD_REF_SLUG | +| ------------------------------ | -------------------- | +| refs/heads/main | main | +| refs/heads/feat/new_feature | feat-new-feature | +| refs/heads/New_Awesome_Product | new-awesome-product | + +[1]: https://docs.github.com/en/developers/webhooks-and-events/webhook-events-and-payloads diff --git a/examples/linux-usage.yml b/examples/linux-usage.yml new file mode 100644 index 0000000..f9aa169 --- /dev/null +++ b/examples/linux-usage.yml @@ -0,0 +1,27 @@ +name: Linux usage + +on: push + +jobs: + usage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: rlespinasse/github-slug-action@v3.x + - name: Output + run: | + echo "Slug variables" + 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 " 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 new file mode 100644 index 0000000..be0d8f0 --- /dev/null +++ b/examples/macos-usage.yml @@ -0,0 +1,27 @@ +name: MacOS usage + +on: push + +jobs: + usage: + runs-on: macos-latest + steps: + - uses: actions/checkout@v2 + - uses: rlespinasse/github-slug-action@v3.x + - name: Output + run: | + echo "Slug variables" + 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 " 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/url-use.yml b/examples/url-use.yml new file mode 100644 index 0000000..71103e0 --- /dev/null +++ b/examples/url-use.yml @@ -0,0 +1,20 @@ +name: URL use + +on: push + +jobs: + as_subdomain: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: rlespinasse/github-slug-action@v3.x + - run: | + ./deploy-application.sh --url "https://${{ env.GITHUB_REF_SLUG_URL }}.staging.app.mycompany.com" + + as_resource_path: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: rlespinasse/github-slug-action@v3.x + - run: | + ./deploy-application.sh --url "https://staging.app.mycompany.com/${{ env.GITHUB_REF_SLUG_URL }}" diff --git a/examples/windows-usage.yml b/examples/windows-usage.yml new file mode 100644 index 0000000..c984ce4 --- /dev/null +++ b/examples/windows-usage.yml @@ -0,0 +1,27 @@ +name: Windows usage + +on: push + +jobs: + usage: + runs-on: windows-latest + steps: + - uses: actions/checkout@v2 + - uses: rlespinasse/github-slug-action@v3.x + - name: Output + run: | + echo "Slug variables" + 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 " 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"