├── .nvmrc ├── .github ├── FUNDING.yml ├── workflows │ ├── ci.yml │ └── demo.yml └── stale.yml ├── .editorconfig ├── images └── github-env-vars-action-social-preview.png ├── action.yml ├── .eslintrc.json ├── Makefile ├── .devcontainer ├── Dockerfile └── devcontainer.json ├── package.json ├── LICENSE ├── index.test.js ├── .gitignore ├── index.js └── README.md /.nvmrc: -------------------------------------------------------------------------------- 1 | v20 2 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: FranzDiebold 2 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | [*.js] 2 | indent_style = space 3 | indent_size = 2 4 | -------------------------------------------------------------------------------- /images/github-env-vars-action-social-preview.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/FranzDiebold/github-env-vars-action/HEAD/images/github-env-vars-action-social-preview.png -------------------------------------------------------------------------------- /action.yml: -------------------------------------------------------------------------------- 1 | name: 'GitHub Environment Variables Action' 2 | description: 'Expose useful Environment Variables.' 3 | author: 'Franz Diebold' 4 | runs: 5 | using: 'node20' 6 | main: 'dist/index.js' 7 | branding: 8 | icon: 'plus-circle' 9 | color: 'green' 10 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "env": { 3 | "browser": true, 4 | "commonjs": true, 5 | "es2020": true 6 | }, 7 | "extends": [ 8 | "google" 9 | ], 10 | "parserOptions": { 11 | "ecmaVersion": 11 12 | }, 13 | "rules": { 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: Lint and Test 2 | 3 | on: [push] 4 | 5 | jobs: 6 | lint_and_test: 7 | runs-on: ubuntu-latest 8 | steps: 9 | - uses: actions/checkout@v4 10 | with: 11 | persist-credentials: false 12 | - uses: actions/setup-node@v4 13 | with: 14 | node-version: 20 15 | - name: Install dependencies 16 | run: make install 17 | - name: Lint 18 | run: make lint 19 | - name: Test 20 | run: make test 21 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | .PHONY: help 2 | help: ## Show this help. 3 | @egrep '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-22s\033[0m %s\n", $$1, $$2}' 4 | 5 | .PHONY: install 6 | install: ## Install dependencies. 7 | npm install 8 | 9 | .PHONY: lint 10 | lint: ## Lint code. 11 | npm run lint 12 | 13 | .PHONY: audit 14 | audit: ## Audit and fix NPM vulnerabilities. 15 | npm audit fix 16 | 17 | .PHONY: test 18 | test: ## Run tests. 19 | npm run test 20 | 21 | .PHONY: build 22 | build: ## Build code for distribution. 23 | npm run build 24 | -------------------------------------------------------------------------------- /.github/stale.yml: -------------------------------------------------------------------------------- 1 | # Number of days of inactivity before an issue becomes stale 2 | daysUntilStale: 30 3 | # Number of days of inactivity before a stale issue is closed 4 | daysUntilClose: 7 5 | # Issues with these labels will never be considered stale 6 | exemptLabels: 7 | - pinned 8 | - security 9 | # Label to use when marking an issue as stale 10 | staleLabel: stale 11 | # Comment to post when marking an issue as stale. Set to `false` to disable 12 | markComment: > 13 | This issue has been automatically marked as stale because it has not had 14 | recent activity. It will be closed if no further activity occurs. Thank you 15 | for your contributions. 16 | # Comment to post when closing a stale issue. Set to `false` to disable 17 | closeComment: false 18 | -------------------------------------------------------------------------------- /.devcontainer/Dockerfile: -------------------------------------------------------------------------------- 1 | # See here for image contents: https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/javascript-node/.devcontainer/base.Dockerfile 2 | 3 | # [Choice] Node.js version (use -bullseye variants on local arm64/Apple Silicon): 16, 14, 12, 16-bullseye, 14-bullseye, 12-bullseye, 16-buster, 14-buster, 12-buster 4 | ARG VARIANT="20-bullseye" 5 | FROM mcr.microsoft.com/vscode/devcontainers/javascript-node:0-${VARIANT} 6 | 7 | # [Optional] Uncomment this section to install additional OS packages. 8 | # RUN apt-get update && export DEBIAN_FRONTEND=noninteractive \ 9 | # && apt-get -y install --no-install-recommends 10 | 11 | # [Optional] Uncomment if you want to install an additional version of node using nvm 12 | # ARG EXTRA_NODE_VERSION=10 13 | # RUN su node -c "source /usr/local/share/nvm/nvm.sh && nvm install ${EXTRA_NODE_VERSION}" 14 | 15 | # [Optional] Uncomment if you want to install more global node modules 16 | # RUN su node -c "npm install -g " 17 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "github-env-vars-action", 3 | "version": "2.8.0", 4 | "description": "A GitHub Action to expose useful environment variables.", 5 | "main": "index.js", 6 | "scripts": { 7 | "lint": "eslint *.js", 8 | "test": "jest", 9 | "build": "ncc build index.js" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/FranzDiebold/github-env-vars-action.git" 14 | }, 15 | "keywords": [ 16 | "Environment variables", 17 | "GitHub Action" 18 | ], 19 | "author": "Franz Diebold", 20 | "license": "MIT", 21 | "bugs": { 22 | "url": "https://github.com/FranzDiebold/github-env-vars-action/issues" 23 | }, 24 | "homepage": "https://github.com/FranzDiebold/github-env-vars-action#readme", 25 | "engines": { 26 | "node": ">=20" 27 | }, 28 | "dependencies": { 29 | "@actions/core": "^1.10.1", 30 | "@actions/github": "^6.0.0" 31 | }, 32 | "devDependencies": { 33 | "@vercel/ncc": "^0.38.1", 34 | "eslint": "^8.56.0", 35 | "eslint-config-google": "^0.14.0", 36 | "jest": "^29.7.0" 37 | } 38 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020 Franz Diebold 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /.devcontainer/devcontainer.json: -------------------------------------------------------------------------------- 1 | // For format details, see https://aka.ms/devcontainer.json. For config options, see the README at: 2 | // https://github.com/microsoft/vscode-dev-containers/tree/v0.209.6/containers/javascript-node 3 | { 4 | "name": "Node.js", 5 | "build": { 6 | "dockerfile": "Dockerfile", 7 | // Update 'VARIANT' to pick a Node version: 16, 14, 12. 8 | // Append -bullseye or -buster to pin to an OS version. 9 | // Use -bullseye variants on local arm64/Apple Silicon. 10 | "args": { 11 | "VARIANT": "20" 12 | } 13 | }, 14 | // Set *default* container specific settings.json values on container create. 15 | "settings": {}, 16 | // Add the IDs of extensions you want installed when the container is created. 17 | "extensions": [ 18 | "dbaeumer.vscode-eslint" 19 | ], 20 | // Use 'forwardPorts' to make a list of ports inside the container available locally. 21 | // "forwardPorts": [], 22 | // Use 'postCreateCommand' to run commands after the container is created. 23 | // "postCreateCommand": "yarn install", 24 | // Comment out connect as root instead. More info: https://aka.ms/vscode-remote/containers/non-root. 25 | "remoteUser": "node" 26 | } -------------------------------------------------------------------------------- /index.test.js: -------------------------------------------------------------------------------- 1 | const { 2 | slugify, getRepositoryOwner, getRepositoryName, getRefName, getShaShort, 3 | } = require('./index'); 4 | 5 | test('slugifies text', () => { 6 | expect(slugify(' /abc+efg*123/test§xyz ')).toEqual('abc-efg-123-test-xyz'); 7 | }); 8 | 9 | test('slugifies a text to a maximum length', () => { 10 | expect(slugify(' /abc+efg*123/test§xyz 1234567 /(ö) ', 16)) 11 | .toEqual('abc-efg-123-test'); 12 | }); 13 | 14 | test('slugifies a text to a maximum length with trailing dash', () => { 15 | expect(slugify(' /abc+efg*123/test§xyz 1234567 /(ö) ', 17)) 16 | .toEqual('abc-efg-123-test'); 17 | }); 18 | 19 | test('slugifies ref name with dash', () => { 20 | expect(slugify('feat/feature-branch-1')).toEqual('feat-feature-branch-1'); 21 | }); 22 | 23 | test('slugifies empty text', () => { 24 | expect(slugify('')).toEqual(''); 25 | }); 26 | 27 | test('gets repository owner', () => { 28 | expect(getRepositoryOwner('FranzDiebold/github-env-vars-action')) 29 | .toEqual('FranzDiebold'); 30 | }); 31 | 32 | test('gets repository owner for empty repository', () => { 33 | expect(getRepositoryOwner(undefined)).toBeFalsy(); 34 | }); 35 | 36 | test('gets repository name from repository', () => { 37 | expect(getRepositoryName('FranzDiebold/github-env-vars-action')) 38 | .toEqual('github-env-vars-action'); 39 | }); 40 | 41 | test('gets repository name for empty repository', () => { 42 | expect(getRepositoryName(undefined)).toBeFalsy(); 43 | }); 44 | 45 | test('gets ref name from simple ref', () => { 46 | expect(getRefName('refs/heads/feature-branch-1')) 47 | .toEqual('feature-branch-1'); 48 | }); 49 | 50 | test('gets ref name from tag', () => { 51 | expect(getRefName('refs/tags/v1.3.7')) 52 | .toEqual('v1.3.7'); 53 | }); 54 | 55 | test('gets ref name from complex ref', () => { 56 | expect(getRefName('refs/heads/feat/feature-branch-1')) 57 | .toEqual('feat/feature-branch-1'); 58 | }); 59 | 60 | test('gets ref name for empty ref', () => { 61 | expect(getRefName(undefined)).toBeFalsy(); 62 | }); 63 | 64 | test('gets short SHA', () => { 65 | expect(getShaShort('ffac537e6cbbf934b08745a378932722df287a53')) 66 | .toEqual('ffac537e'); 67 | }); 68 | 69 | test('gets short SHA for empty SHA', () => { 70 | expect(getShaShort(undefined)).toBeFalsy(); 71 | }); 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | # Created by https://www.gitignore.io/api/node,macos,visualstudiocode 3 | # Edit at https://www.gitignore.io/?templates=node,macos,visualstudiocode 4 | 5 | ### macOS ### 6 | # General 7 | .DS_Store 8 | .AppleDouble 9 | .LSOverride 10 | 11 | # Icon must end with two \r 12 | Icon 13 | 14 | # Thumbnails 15 | ._* 16 | 17 | # Files that might appear in the root of a volume 18 | .DocumentRevisions-V100 19 | .fseventsd 20 | .Spotlight-V100 21 | .TemporaryItems 22 | .Trashes 23 | .VolumeIcon.icns 24 | .com.apple.timemachine.donotpresent 25 | 26 | # Directories potentially created on remote AFP share 27 | .AppleDB 28 | .AppleDesktop 29 | Network Trash Folder 30 | Temporary Items 31 | .apdisk 32 | 33 | ### Node ### 34 | # Logs 35 | logs 36 | *.log 37 | npm-debug.log* 38 | yarn-debug.log* 39 | yarn-error.log* 40 | lerna-debug.log* 41 | 42 | # Diagnostic reports (https://nodejs.org/api/report.html) 43 | report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json 44 | 45 | # Runtime data 46 | pids 47 | *.pid 48 | *.seed 49 | *.pid.lock 50 | 51 | # Directory for instrumented libs generated by jscoverage/JSCover 52 | lib-cov 53 | 54 | # Coverage directory used by tools like istanbul 55 | coverage 56 | *.lcov 57 | 58 | # nyc test coverage 59 | .nyc_output 60 | 61 | # Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) 62 | .grunt 63 | 64 | # Bower dependency directory (https://bower.io/) 65 | bower_components 66 | 67 | # node-waf configuration 68 | .lock-wscript 69 | 70 | # Compiled binary addons (https://nodejs.org/api/addons.html) 71 | build/Release 72 | 73 | # Dependency directories 74 | node_modules/ 75 | jspm_packages/ 76 | 77 | # TypeScript v1 declaration files 78 | typings/ 79 | 80 | # TypeScript cache 81 | *.tsbuildinfo 82 | 83 | # Optional npm cache directory 84 | .npm 85 | 86 | # Optional eslint cache 87 | .eslintcache 88 | 89 | # Optional REPL history 90 | .node_repl_history 91 | 92 | # Output of 'npm pack' 93 | *.tgz 94 | 95 | # Yarn Integrity file 96 | .yarn-integrity 97 | 98 | # dotenv environment variables file 99 | .env 100 | .env.test 101 | 102 | # parcel-bundler cache (https://parceljs.org/) 103 | .cache 104 | 105 | # next.js build output 106 | .next 107 | 108 | # nuxt.js build output 109 | .nuxt 110 | 111 | # Uncomment the public line if your project uses Gatsby 112 | # https://nextjs.org/blog/next-9-1#public-directory-support 113 | # https://create-react-app.dev/docs/using-the-public-folder/#docsNav 114 | # public 115 | 116 | # Storybook build outputs 117 | .out 118 | .storybook-out 119 | 120 | # vuepress build output 121 | .vuepress/dist 122 | 123 | # Serverless directories 124 | .serverless/ 125 | 126 | # FuseBox cache 127 | .fusebox/ 128 | 129 | # DynamoDB Local files 130 | .dynamodb/ 131 | 132 | # Temporary folders 133 | tmp/ 134 | temp/ 135 | 136 | ### VisualStudioCode ### 137 | .vscode/* 138 | !.vscode/settings.json 139 | !.vscode/tasks.json 140 | !.vscode/launch.json 141 | !.vscode/extensions.json 142 | 143 | ### VisualStudioCode Patch ### 144 | # Ignore all local history of files 145 | .history 146 | 147 | # End of https://www.gitignore.io/api/node,macos,visualstudiocode 148 | -------------------------------------------------------------------------------- /.github/workflows/demo.yml: -------------------------------------------------------------------------------- 1 | name: Demo 2 | 3 | on: [push, pull_request] 4 | 5 | jobs: 6 | linux: 7 | name: Linux Demo 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: FranzDiebold/github-env-vars-action@v2 11 | - name: Print environment variables exposed by this action 12 | run: | 13 | echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" 14 | echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" 15 | echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" 16 | echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" 17 | echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" 18 | echo "CI_REPOSITORY=$CI_REPOSITORY" 19 | echo "CI_REF_SLUG=$CI_REF_SLUG" 20 | echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" 21 | echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" 22 | echo "CI_REF_NAME=$CI_REF_NAME" 23 | echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" 24 | echo "CI_REF=$CI_REF" 25 | echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" 26 | echo "CI_HEAD_REF=$CI_HEAD_REF" 27 | echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" 28 | echo "CI_BASE_REF=$CI_BASE_REF" 29 | echo "CI_SHA_SHORT=$CI_SHA_SHORT" 30 | echo "CI_SHA=$CI_SHA" 31 | echo "CI_PR_SHA_SHORT=$CI_PR_SHA_SHORT" 32 | echo "CI_PR_SHA=$CI_PR_SHA" 33 | echo "CI_PR_NUMBER=$CI_PR_NUMBER" 34 | echo "CI_PR_ID=$CI_PR_ID" 35 | echo "CI_PR_TITLE=$CI_PR_TITLE" 36 | echo "CI_PR_DESCRIPTION=$CI_PR_DESCRIPTION" 37 | echo "CI_ACTOR=$CI_ACTOR" 38 | echo "CI_EVENT_NAME=$CI_EVENT_NAME" 39 | echo "CI_RUN_ID=$CI_RUN_ID" 40 | echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" 41 | echo "CI_WORKFLOW=$CI_WORKFLOW" 42 | echo "CI_ACTION=$CI_ACTION" 43 | - name: Print environment variables exposed by GitHub 44 | run: | 45 | echo "GITHUB_ACTOR=$GITHUB_ACTOR" 46 | echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" 47 | echo "GITHUB_SHA=$GITHUB_SHA" 48 | echo "GITHUB_REF=$GITHUB_REF" 49 | echo "GITHUB_HEAD_REF=$GITHUB_HEAD_REF" 50 | echo "GITHUB_BASE_REF=$GITHUB_BASE_REF" 51 | echo "GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME" 52 | echo "GITHUB_RUN_ID=$GITHUB_RUN_ID" 53 | echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER" 54 | echo "GITHUB_WORKFLOW=$GITHUB_WORKFLOW" 55 | echo "GITHUB_ACTION=$GITHUB_ACTION" 56 | 57 | windows: 58 | name: Windows Demo 59 | runs-on: windows-latest 60 | steps: 61 | - uses: FranzDiebold/github-env-vars-action@v2 62 | - name: Print environment variables exposed by this action 63 | run: | 64 | echo "CI_REPOSITORY_SLUG=$Env:CI_REPOSITORY_SLUG" 65 | echo "CI_REPOSITORY_OWNER=$Env:CI_REPOSITORY_OWNER" 66 | echo "CI_REPOSITORY_OWNER_SLUG=$Env:CI_REPOSITORY_OWNER_SLUG" 67 | echo "CI_REPOSITORY_NAME=$Env:CI_REPOSITORY_NAME" 68 | echo "CI_REPOSITORY_NAME_SLUG=$Env:CI_REPOSITORY_NAME_SLUG" 69 | echo "CI_REPOSITORY=$Env:CI_REPOSITORY" 70 | echo "CI_REF_SLUG=$Env:CI_REF_SLUG" 71 | echo "CI_ACTION_REF_NAME=$Env:CI_ACTION_REF_NAME" 72 | echo "CI_ACTION_REF_NAME_SLUG=$Env:CI_ACTION_REF_NAME_SLUG" 73 | echo "CI_REF_NAME=$Env:CI_REF_NAME" 74 | echo "CI_REF_NAME_SLUG=$Env:CI_REF_NAME_SLUG" 75 | echo "CI_REF=$Env:CI_REF" 76 | echo "CI_HEAD_REF_SLUG=$Env:CI_HEAD_REF_SLUG" 77 | echo "CI_HEAD_REF=$Env:CI_HEAD_REF" 78 | echo "CI_BASE_REF_SLUG=$Env:CI_BASE_REF_SLUG" 79 | echo "CI_BASE_REF=$Env:CI_BASE_REF" 80 | echo "CI_SHA_SHORT=$Env:CI_SHA_SHORT" 81 | echo "CI_SHA=$Env:CI_SHA" 82 | echo "CI_PR_SHA_SHORT=$Env:CI_PR_SHA_SHORT" 83 | echo "CI_PR_SHA=$Env:CI_PR_SHA" 84 | echo "CI_PR_NUMBER=$Env:CI_PR_NUMBER" 85 | echo "CI_PR_ID=$Env:CI_PR_ID" 86 | echo "CI_PR_TITLE=$Env:CI_PR_TITLE" 87 | echo "CI_PR_DESCRIPTION=$Env:CI_PR_DESCRIPTION" 88 | echo "CI_ACTOR=$Env:CI_ACTOR" 89 | echo "CI_EVENT_NAME=$Env:CI_EVENT_NAME" 90 | echo "CI_RUN_ID=$Env:CI_RUN_ID" 91 | echo "CI_RUN_NUMBER=$Env:CI_RUN_NUMBER" 92 | echo "CI_WORKFLOW=$Env:CI_WORKFLOW" 93 | echo "CI_ACTION=$Env:CI_ACTION" 94 | - name: Print environment variables exposed by GitHub 95 | run: | 96 | echo "GITHUB_ACTOR=$Env:GITHUB_ACTOR" 97 | echo "GITHUB_REPOSITORY=$Env:GITHUB_REPOSITORY" 98 | echo "GITHUB_SHA=$Env:GITHUB_SHA" 99 | echo "GITHUB_REF=$Env:GITHUB_REF" 100 | echo "GITHUB_HEAD_REF=$Env:GITHUB_HEAD_REF" 101 | echo "GITHUB_BASE_REF=$Env:GITHUB_BASE_REF" 102 | echo "GITHUB_EVENT_NAME=$Env:GITHUB_EVENT_NAME" 103 | echo "GITHUB_RUN_ID=$Env:GITHUB_RUN_ID" 104 | echo "GITHUB_RUN_NUMBER=$Env:GITHUB_RUN_NUMBER" 105 | echo "GITHUB_WORKFLOW=$Env:GITHUB_WORKFLOW" 106 | echo "GITHUB_ACTION=$Env:GITHUB_ACTION" 107 | 108 | macos: 109 | name: macOS Demo 110 | runs-on: macos-latest 111 | steps: 112 | - uses: FranzDiebold/github-env-vars-action@v2 113 | - name: Print environment variables exposed by this action 114 | run: | 115 | echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" 116 | echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" 117 | echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" 118 | echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" 119 | echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" 120 | echo "CI_REPOSITORY=$CI_REPOSITORY" 121 | echo "CI_REF_SLUG=$CI_REF_SLUG" 122 | echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" 123 | echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" 124 | echo "CI_REF_NAME=$CI_REF_NAME" 125 | echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" 126 | echo "CI_REF=$CI_REF" 127 | echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" 128 | echo "CI_HEAD_REF=$CI_HEAD_REF" 129 | echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" 130 | echo "CI_BASE_REF=$CI_BASE_REF" 131 | echo "CI_SHA_SHORT=$CI_SHA_SHORT" 132 | echo "CI_SHA=$CI_SHA" 133 | echo "CI_PR_SHA_SHORT=$CI_PR_SHA_SHORT" 134 | echo "CI_PR_SHA=$CI_PR_SHA" 135 | echo "CI_PR_NUMBER=$CI_PR_NUMBER" 136 | echo "CI_PR_ID=$CI_PR_ID" 137 | echo "CI_PR_TITLE=$CI_PR_TITLE" 138 | echo "CI_PR_DESCRIPTION=$CI_PR_DESCRIPTION" 139 | echo "CI_ACTOR=$CI_ACTOR" 140 | echo "CI_EVENT_NAME=$CI_EVENT_NAME" 141 | echo "CI_RUN_ID=$CI_RUN_ID" 142 | echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" 143 | echo "CI_WORKFLOW=$CI_WORKFLOW" 144 | echo "CI_ACTION=$CI_ACTION" 145 | - name: Print environment variables exposed by GitHub 146 | run: | 147 | echo "GITHUB_ACTOR=$GITHUB_ACTOR" 148 | echo "GITHUB_REPOSITORY=$GITHUB_REPOSITORY" 149 | echo "GITHUB_SHA=$GITHUB_SHA" 150 | echo "GITHUB_REF=$GITHUB_REF" 151 | echo "GITHUB_HEAD_REF=$GITHUB_HEAD_REF" 152 | echo "GITHUB_BASE_REF=$GITHUB_BASE_REF" 153 | echo "GITHUB_EVENT_NAME=$GITHUB_EVENT_NAME" 154 | echo "GITHUB_RUN_ID=$GITHUB_RUN_ID" 155 | echo "GITHUB_RUN_NUMBER=$GITHUB_RUN_NUMBER" 156 | echo "GITHUB_WORKFLOW=$GITHUB_WORKFLOW" 157 | echo "GITHUB_ACTION=$GITHUB_ACTION" 158 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | // Franz Diebold 2 | 3 | const core = require('@actions/core'); 4 | const github = require('@actions/github'); 5 | 6 | /** 7 | * Slugify a given string to a maximum length. 8 | * @param {string} inputString 9 | * @param {int} maxLength 10 | * @return {string} The slugified string. 11 | */ 12 | function slugify(inputString, maxLength = 63) { 13 | return inputString 14 | .toLowerCase() 15 | .replace(/[^a-z0-9 -]/g, ' ') // remove invalid chars 16 | .replace(/^\s+|\s+$/g, '') // trim 17 | .replace(/\s+/g, '-') // collapse whitespace and replace by - 18 | .replace(/-+/g, '-') // collapse dashes 19 | .slice(0, maxLength) // truncate to maximum length 20 | .replace(/[-]+$/g, ''); // trim trailing - 21 | } 22 | 23 | /** 24 | * Get the repository owner from the repository string. 25 | * @param {string} repository 26 | * @return {string} The owner of the repository. 27 | */ 28 | function getRepositoryOwner(repository) { 29 | return repository ? repository.split('/')[0] : null; 30 | } 31 | 32 | /** 33 | * Get the repository name from the repository string. 34 | * @param {string} repository 35 | * @return {string} The name of the repository. 36 | */ 37 | function getRepositoryName(repository) { 38 | return repository ? repository.split('/')[1] : null; 39 | } 40 | 41 | /** 42 | * Get the ref name from the ref string. 43 | * @param {string} ref 44 | * @return {string} The ref name. 45 | */ 46 | function getRefName(ref) { 47 | return ref ? ref.split('/').slice(2).join('/') : null; 48 | } 49 | 50 | /** 51 | * Get the short SHA from the full SHA. 52 | * @param {string} fullSha 53 | * @return {string} The short SHA. 54 | */ 55 | function getShaShort(fullSha) { 56 | return fullSha ? fullSha.substring(0, 8) : null; 57 | } 58 | 59 | // https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables 60 | 61 | try { 62 | // i.e. FranzDiebold/github-env-vars-action 63 | const repository = process.env.GITHUB_REPOSITORY; 64 | 65 | if (repository) { 66 | core.exportVariable('CI_REPOSITORY_SLUG', slugify(repository)); 67 | core.info(`Set CI_REPOSITORY_SLUG=` + 68 | `${process.env.CI_REPOSITORY_SLUG}`); 69 | } else { 70 | core.info('Environment variable "GITHUB_REPOSITORY" not set. ' + 71 | 'Cannot set "CI_REPOSITORY_SLUG".'); 72 | } 73 | 74 | const repositoryOwner = getRepositoryOwner(repository); 75 | if (repositoryOwner) { 76 | core.exportVariable('CI_REPOSITORY_OWNER', repositoryOwner); 77 | core.info(`Set CI_REPOSITORY_OWNER=` + 78 | `${process.env.CI_REPOSITORY_OWNER}`); 79 | 80 | core.exportVariable('CI_REPOSITORY_OWNER_SLUG', 81 | slugify(repositoryOwner)); 82 | core.info(`Set CI_REPOSITORY_OWNER_SLUG=` + 83 | `${process.env.CI_REPOSITORY_OWNER_SLUG}`); 84 | } else { 85 | core.info('Environment variable "GITHUB_REPOSITORY" not set. ' + 86 | 'Cannot set "CI_REPOSITORY_OWNER" and ' + 87 | '"CI_REPOSITORY_OWNER_SLUG".'); 88 | } 89 | 90 | const repositoryName = getRepositoryName(repository); 91 | if (repositoryName) { 92 | core.exportVariable('CI_REPOSITORY_NAME', repositoryName); 93 | core.info(`Set CI_REPOSITORY_NAME=` + 94 | `${process.env.CI_REPOSITORY_NAME}`); 95 | 96 | core.exportVariable('CI_REPOSITORY_NAME_SLUG', 97 | slugify(repositoryName)); 98 | core.info(`Set CI_REPOSITORY_NAME_SLUG=` + 99 | `${process.env.CI_REPOSITORY_NAME_SLUG}`); 100 | } else { 101 | core.info('Environment variable "GITHUB_REPOSITORY" not set. ' + 102 | 'Cannot set "CI_REPOSITORY_NAME" and ' + 103 | '"CI_REPOSITORY_NAME_SLUG".'); 104 | } 105 | 106 | core.exportVariable('CI_REPOSITORY', repository); 107 | core.info(`Set CI_REPOSITORY=${process.env.CI_REPOSITORY}`); 108 | 109 | // i.e. refs/heads/feat/feature-branch-1 110 | const ref = process.env.GITHUB_REF; 111 | 112 | if (ref) { 113 | core.exportVariable('CI_REF_SLUG', slugify(ref)); 114 | core.info(`Set CI_REF_SLUG=${process.env.CI_REF_SLUG}`); 115 | } else { 116 | core.info('Environment variable "GITHUB_REF" not set. ' + 117 | 'Cannot set "CI_REF_SLUG".'); 118 | } 119 | 120 | const refName = getRefName(ref); 121 | if (refName) { 122 | core.exportVariable('CI_REF_NAME', refName); 123 | core.info(`Set CI_REF_NAME=${process.env.CI_REF_NAME}`); 124 | 125 | core.exportVariable('CI_REF_NAME_SLUG', slugify(refName)); 126 | core.info(`Set CI_REF_NAME_SLUG=${process.env.CI_REF_NAME_SLUG}`); 127 | } else { 128 | core.info('Environment variable "GITHUB_REF" not set. ' + 129 | 'Cannot set "CI_REF_NAME" and ' + 130 | '"CI_REF_NAME_SLUG".'); 131 | } 132 | 133 | core.exportVariable('CI_REF', ref); 134 | core.info(`Set CI_REF=${process.env.CI_REF}`); 135 | 136 | const headRef = process.env.GITHUB_HEAD_REF; 137 | 138 | const branchName = headRef || refName; 139 | if (branchName) { 140 | core.exportVariable('CI_ACTION_REF_NAME', branchName); 141 | core.info(`Set CI_ACTION_REF_NAME=${process.env.CI_ACTION_REF_NAME}`); 142 | 143 | core.exportVariable('CI_ACTION_REF_NAME_SLUG', slugify(branchName)); 144 | core.info('Set CI_ACTION_REF_NAME_SLUG=' + 145 | `${process.env.CI_ACTION_REF_NAME_SLUG}`); 146 | } else { 147 | core.info('Environment variables "GITHUB_REF" and ' + 148 | '"GITHUB_HEAD_REF" not set. ' + 149 | 'Cannot set "CI_ACTION_REF_NAME" and ' + 150 | '"CI_ACTION_REF_NAME_SLUG".'); 151 | } 152 | 153 | if (headRef) { 154 | core.exportVariable('CI_HEAD_REF_SLUG', slugify(headRef)); 155 | core.info(`Set CI_HEAD_REF_SLUG=${process.env.CI_HEAD_REF_SLUG}`); 156 | } else { 157 | core.info('Environment variable "GITHUB_HEAD_REF" not set. ' + 158 | 'Cannot set "CI_HEAD_REF_SLUG".'); 159 | } 160 | 161 | core.exportVariable('CI_HEAD_REF', headRef); 162 | core.info(`Set CI_HEAD_REF=${process.env.CI_HEAD_REF}`); 163 | 164 | const baseRef = process.env.GITHUB_BASE_REF; 165 | if (baseRef) { 166 | core.exportVariable('CI_BASE_REF_SLUG', slugify(baseRef)); 167 | core.info(`Set CI_BASE_REF_SLUG=${process.env.CI_BASE_REF_SLUG}`); 168 | } else { 169 | core.info('Environment variable "GITHUB_BASE_REF" not set. ' + 170 | 'Cannot set "CI_BASE_REF_SLUG".'); 171 | } 172 | 173 | core.exportVariable('CI_BASE_REF', baseRef); 174 | core.info(`Set CI_BASE_REF=${process.env.CI_BASE_REF}`); 175 | 176 | // i.e. ffac537e6cbbf934b08745a378932722df287a53 177 | const sha = process.env.GITHUB_SHA; 178 | if (sha) { 179 | core.exportVariable('CI_SHA_SHORT', getShaShort(sha)); 180 | core.info(`Set CI_SHA_SHORT=${process.env.CI_SHA_SHORT}`); 181 | } else { 182 | core.info('Environment variable "GITHUB_SHA" not set. ' + 183 | 'Cannot set "CI_SHA_SHORT".'); 184 | } 185 | 186 | core.exportVariable('CI_SHA', sha); 187 | core.info(`Set CI_SHA=${process.env.CI_SHA}`); 188 | 189 | const pullRequest = github.context.payload && 190 | github.context.payload.pull_request; 191 | if (pullRequest) { 192 | const prSha = pullRequest.head.sha; 193 | core.exportVariable('CI_PR_SHA_SHORT', getShaShort(prSha)); 194 | core.info(`Set CI_PR_SHA_SHORT=${process.env.CI_PR_SHA_SHORT}`); 195 | 196 | core.exportVariable('CI_PR_SHA', prSha); 197 | core.info(`Set CI_PR_SHA=${process.env.CI_PR_SHA}`); 198 | 199 | const prNumber = pullRequest.number; 200 | core.exportVariable('CI_PR_NUMBER', prNumber); 201 | core.info(`Set CI_PR_NUMBER=${process.env.CI_PR_NUMBER}`); 202 | 203 | core.exportVariable('CI_PR_ID', prNumber); 204 | core.info(`Set CI_PR_ID=${process.env.CI_PR_ID}`); 205 | 206 | const prTitle = pullRequest.title; 207 | core.exportVariable('CI_PR_TITLE', prTitle); 208 | core.info(`Set CI_PR_TITLE=${process.env.CI_PR_TITLE}`); 209 | 210 | const prDescription = pullRequest.body; 211 | core.exportVariable('CI_PR_DESCRIPTION', prDescription); 212 | core.info(`Set CI_PR_DESCRIPTION=${process.env.CI_PR_DESCRIPTION}`); 213 | } else { 214 | core.info('No pull request. ' + 215 | 'Cannot set "CI_PR_SHA_SHORT", "CI_PR_SHA", "CI_PR_NUMBER", ' + 216 | '"CI_PR_ID", "CI_PR_TITLE" and "CI_PR_DESCRIPTION".'); 217 | } 218 | 219 | const actor = process.env.GITHUB_ACTOR; 220 | core.exportVariable('CI_ACTOR', actor); 221 | core.info(`Set CI_ACTOR=${process.env.CI_ACTOR}`); 222 | 223 | const eventName = process.env.GITHUB_EVENT_NAME; 224 | core.exportVariable('CI_EVENT_NAME', eventName); 225 | core.info(`Set CI_EVENT_NAME=${process.env.CI_EVENT_NAME}`); 226 | 227 | const runId = process.env.GITHUB_RUN_ID; 228 | core.exportVariable('CI_RUN_ID', runId); 229 | core.info(`Set CI_RUN_ID=${process.env.CI_RUN_ID}`); 230 | 231 | const runNumber = process.env.GITHUB_RUN_NUMBER; 232 | core.exportVariable('CI_RUN_NUMBER', runNumber); 233 | core.info(`Set CI_RUN_NUMBER=${process.env.CI_RUN_NUMBER}`); 234 | 235 | const workflow = process.env.GITHUB_WORKFLOW; 236 | core.exportVariable('CI_WORKFLOW', workflow); 237 | core.info(`Set CI_WORKFLOW=${process.env.CI_WORKFLOW}`); 238 | 239 | const action = process.env.GITHUB_ACTION; 240 | core.exportVariable('CI_ACTION', action); 241 | core.info(`Set CI_ACTION=${process.env.CI_ACTION}`); 242 | } catch (error) { 243 | core.setFailed(error.message); 244 | } 245 | 246 | module.exports = { 247 | slugify, 248 | getRepositoryOwner, 249 | getRepositoryName, 250 | getRefName, 251 | getShaShort, 252 | }; 253 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # :octocat: :rocket: GitHub Environment Variables Action 2 | 3 | [![GitHub Action: View on Marketplace](https://img.shields.io/badge/GitHub%20Action-View_on_Marketplace-28a745?logo=github)](https://github.com/marketplace/actions/github-environment-variables-action) 4 | [![Demo: available](https://img.shields.io/badge/Demo-available-orange)](.github/workflows/demo.yml) 5 | [![Version: v2.8.0](https://img.shields.io/badge/Version-v2.8.0-brightgreen)](https://github.com/FranzDiebold/github-env-vars-action/releases/tag/v2.8.0) 6 | [![Lint and Test](https://github.com/FranzDiebold/github-env-vars-action/workflows/Lint%20and%20Test/badge.svg)](https://github.com/FranzDiebold/github-env-vars-action/actions?query=workflow%3A%22Lint+and+Test%22) 7 | [![license: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](./LICENSE) 8 | 9 | A [GitHub Action](https://github.com/features/actions) to expose useful environment variables. 10 | 11 | ### Environment Variables exposed by **this Action** 12 | 13 | | Environment Variable Name | Description | Example value | 14 | |--------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------| 15 | | `CI_REPOSITORY_SLUG` | The slug of the owner and repository name (i.e. slug of `FranzDiebold/github-env-vars-action`). The slug is truncated to 63 characters. | `franzdiebold-github-env-vars-action` | 16 | | `CI_REPOSITORY_OWNER` | The owner of the repository. | `FranzDiebold` | 17 | | `CI_REPOSITORY_OWNER_SLUG` | The slug of the owner of the repository. The slug is truncated to 63 characters. | `franzdiebold` | 18 | | `CI_REPOSITORY_NAME` | The name of the repository. | `github-env-vars-action` | 19 | | `CI_REPOSITORY_NAME_SLUG` | The slug of the name of the repository. The slug is truncated to 63 characters. | `github-env-vars-action` | 20 | | `CI_REPOSITORY` | The owner and repository name. Copy of `GITHUB_REPOSITORY` - for reasons of completeness. | `FranzDiebold/github-env-vars-action` | 21 | | `CI_REF_SLUG` | The slug of the branch, tag or PR number *ref* that triggered the workflow (i.e. slug of `refs/heads/feat/feature-branch-1`).
If neither a branch, tag or PR number is available for the event type, the variable will not exist. The slug is truncated to 63 characters. | `refs-heads-feat-feature-branch-1` or
`refs-tags-v1-3-7` or
`refs-pull-42-merge` | 22 | | `CI_ACTION_REF_NAME` | The branch or tag *name* that triggered the workflow. For pull requests it is the *head* branch name. | `feat/feature-branch-1` or
`v1.3.7` | 23 | | `CI_ACTION_REF_NAME_SLUG` | The slug of the branch or tag *name* that triggered the workflow. For pull requests it is the slug of the *head* branch name. The slug is truncated to 63 characters. | `feat-feature-branch-1` or
`v1-3-7` | 24 | | `CI_REF_NAME` | The branch *name*, tag *name* or PR number that triggered the workflow.
If neither a branch, tag or PR number is available for the event type, the variable will not exist. | `feat/feature-branch-1` or
`v1.3.7` or
`42/merge` | 25 | | `CI_REF_NAME_SLUG` | The slug of the branch *name*, tag *name* or PR number that triggered the workflow.
If neither a branch, tag or PR number is available for the event type, the variable will not exist. The slug is truncated to 63 characters. | `feat-feature-branch-1` or
`v1-3-7` or
`42-merge` | 26 | | `CI_REF` | The branch, tag or PR number *ref* that triggered the workflow.
If neither a branch, tag or PR number is available for the event type, the variable will not exist. Copy of `GITHUB_REF` - for reasons of completeness. | `refs/heads/feat/feature-branch-1` or
`refs/tags/v1.3.7` or
`refs/pull/42/merge` | 27 | | `CI_HEAD_REF_SLUG` | The slug of the head branch *name*.
Only set for event type *pull request* or forked repositories. The slug is truncated to 63 characters. | `feat-feature-branch-1` | 28 | | `CI_HEAD_REF` | Only set for forked repositories / pull request. The branch of the head repository / the head branch name. Copy of `GITHUB_HEAD_REF` - for reasons of completeness. | `feat/feature-branch-1` | 29 | | `CI_BASE_REF_SLUG` | The slug of the base branch *name*.
Only set for event type *pull request* or forked repositories. The slug is truncated to 63 characters. | `main` | 30 | | `CI_BASE_REF` | Only set for forked repositories / pull request. The branch of the base repository / the base branch name. Copy of `GITHUB_BASE_REF` - for reasons of completeness. | `main` | 31 | | `CI_SHA_SHORT` | The shortened commit SHA (8 characters) that triggered the workflow. | `ffac537e` | 32 | | `CI_SHA` | The commit SHA that triggered the workflow. Copy of `GITHUB_SHA` - for reasons of completeness. | `ffac537e6cbbf934b08745a378932722df287a53` | 33 | | `CI_PR_SHA_SHORT` | The shortened latest commit SHA in the pull request's base branch. Short version of `CI_PR_SHA`. Only set for pull requests. | `010b249` | 34 | | `CI_PR_SHA` | The latest commit SHA in the pull request's base branch. Long version of `CI_PR_SHA_SHORT`. Only set for pull requests. | `010b2491902d50e8623934f5bc43763ff5991642` | 35 | | `CI_PR_NUMBER` | The number of the pull request. Only set for pull requests. | `42` | 36 | | `CI_PR_ID` | Copy of `CI_PR_NUMBER` for completeness. | `42` | 37 | | `CI_PR_TITLE` | The title of the pull request. Only set for pull requests. | `Add feature xyz.` | 38 | | `CI_PR_DESCRIPTION` | The description of the pull request. Only set for pull requests. | `The feature xyz is the [...]` | 39 | | `CI_ACTOR` | The name of the person or app that initiated the workflow. Copy of `GITHUB_ACTOR` - for reasons of completeness. | `octocat` | 40 | | `CI_EVENT_NAME` | The name of the webhook event that triggered the workflow. Copy of `GITHUB_EVENT_NAME` - for reasons of completeness. | `push` or `pull_request` | 41 | | `CI_RUN_ID` | A unique number for each run within a repository. This number does not change if you re-run the workflow run. Copy of `GITHUB_RUN_ID` - for reasons of completeness. | `397746731` | 42 | | `CI_RUN_NUMBER` | A unique number for each run of a particular workflow in a repository. This number begins at 1 for the workflow's first run, and increments with each new run. This number does not change if you re-run the workflow run. Copy of `GITHUB_RUN_NUMBER` - for reasons of completeness. | `73` | 43 | | `CI_WORKFLOW` | The name of the workflow. Copy of `GITHUB_WORKFLOW` - for reasons of completeness. | `Demo` | 44 | | `CI_ACTION` | The unique identifier (`id`) of the action. Copy of `GITHUB_ACTION` - for reasons of completeness. | `run2` | 45 | 46 | > The [slugified](https://en.wikipedia.org/wiki/Clean_URL#Slug) values are designed to be used in a URL. 47 | 48 | ### Default Environment Variables exposed by GitHub 49 | 50 | For a full list of default environment variables exposed by GitHub see [https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables](https://docs.github.com/en/free-pro-team@latest/actions/reference/environment-variables#default-environment-variables). 51 | 52 | | Environment Variable Name | Description | Example value | 53 | |---------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------| 54 | | `GITHUB_ACTOR` | The name of the person or app that initiated the workflow. | `octocat` | 55 | | `GITHUB_REPOSITORY` | The owner and repository name. | `FranzDiebold/github-env-vars-action` | 56 | | `GITHUB_SHA` | The commit SHA that triggered the workflow. | `ffac537e6cbbf934b08745a378932722df287a53` | 57 | | `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. | `refs/heads/feat/feature-branch-1` | 58 | | `GITHUB_HEAD_REF` | Only set for forked repositories / pull request. The branch of the head repository / the head branch name. | `feat/feature-branch-1` | 59 | | `GITHUB_BASE_REF` | Only set for forked repositories / pull request. The branch of the base repository / the base branch name. | `main` | 60 | | `GITHUB_EVENT_NAME` | The name of the webhook event that triggered the workflow. | `push` | 61 | | `GITHUB_RUN_ID` | A unique number for each run within a repository. This number does not change if you re-run the workflow run. | `397746731` | 62 | | `GITHUB_RUN_NUMBER` | A unique number for each run of a particular workflow in a repository. This number begins at 1 for the workflow's first run, and increments with each new run. This number does not change if you re-run the workflow run. | `73` | 63 | | `GITHUB_WORKFLOW` | The name of the workflow. | `Demo` | 64 | | `GITHUB_ACTION` | The unique identifier (`id`) of the action. | `run2` | 65 | 66 | ## :rocket: Example usage 67 | 68 | ```yaml 69 | steps: 70 | - uses: FranzDiebold/github-env-vars-action@v2 71 | - name: Print environment variables 72 | run: | 73 | echo "CI_REPOSITORY_SLUG=$CI_REPOSITORY_SLUG" 74 | echo "CI_REPOSITORY_OWNER=$CI_REPOSITORY_OWNER" 75 | echo "CI_REPOSITORY_OWNER_SLUG=$CI_REPOSITORY_OWNER_SLUG" 76 | echo "CI_REPOSITORY_NAME=$CI_REPOSITORY_NAME" 77 | echo "CI_REPOSITORY_NAME_SLUG=$CI_REPOSITORY_NAME_SLUG" 78 | echo "CI_REPOSITORY=$CI_REPOSITORY" 79 | echo "CI_REF_SLUG=$CI_REF_SLUG" 80 | echo "CI_ACTION_REF_NAME=$CI_ACTION_REF_NAME" 81 | echo "CI_ACTION_REF_NAME_SLUG=$CI_ACTION_REF_NAME_SLUG" 82 | echo "CI_REF_NAME=$CI_REF_NAME" 83 | echo "CI_REF_NAME_SLUG=$CI_REF_NAME_SLUG" 84 | echo "CI_REF=$CI_REF" 85 | echo "CI_HEAD_REF_SLUG=$CI_HEAD_REF_SLUG" 86 | echo "CI_HEAD_REF=$CI_HEAD_REF" 87 | echo "CI_BASE_REF_SLUG=$CI_BASE_REF_SLUG" 88 | echo "CI_BASE_REF=$CI_BASE_REF" 89 | echo "CI_SHA_SHORT=$CI_SHA_SHORT" 90 | echo "CI_SHA=$CI_SHA" 91 | echo "CI_PR_SHA_SHORT=$CI_PR_SHA_SHORT" 92 | echo "CI_PR_SHA=$CI_PR_SHA" 93 | echo "CI_PR_NUMBER=$CI_PR_NUMBER" 94 | echo "CI_PR_ID=$CI_PR_ID" 95 | echo "CI_PR_TITLE=$CI_PR_TITLE" 96 | echo "CI_PR_DESCRIPTION=$CI_PR_DESCRIPTION" 97 | echo "CI_ACTOR=$CI_ACTOR" 98 | echo "CI_EVENT_NAME=$CI_EVENT_NAME" 99 | echo "CI_RUN_ID=$CI_RUN_ID" 100 | echo "CI_RUN_NUMBER=$CI_RUN_NUMBER" 101 | echo "CI_WORKFLOW=$CI_WORKFLOW" 102 | echo "CI_ACTION=$CI_ACTION" 103 | ``` 104 | 105 | ### Demo 106 | 107 | A demo for all Operating systems (Linux, macOS and Windows) is also available in the [demo workflows file of this repository](.github/workflows/demo.yml)! 108 | --------------------------------------------------------------------------------