Merge pull request #47 from iamstarkov/feat/CI_PR_NUMBER

Expose pull request id as CI_PR_NUMBER and CI_PR_ID
This commit is contained in:
Franz Diebold 2022-07-07 21:36:26 +02:00 committed by GitHub
commit dae1d3475c
WARNING! Although there is a key with this ID in the database it does not verify this commit! This commit is SUSPICIOUS.
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 2428 additions and 2822 deletions

View file

@ -28,6 +28,8 @@ jobs:
echo "CI_BASE_REF=$CI_BASE_REF"
echo "CI_SHA_SHORT=$CI_SHA_SHORT"
echo "CI_SHA=$CI_SHA"
echo "CI_PR_NUMBER=$CI_PR_NUMBER"
echo "CI_PR_ID=$CI_PR_ID"
echo "CI_PR_TITLE=$CI_PR_TITLE"
echo "CI_PR_DESCRIPTION=$CI_PR_DESCRIPTION"
echo "CI_ACTOR=$CI_ACTOR"
@ -75,6 +77,8 @@ jobs:
echo "CI_BASE_REF=$Env:CI_BASE_REF"
echo "CI_SHA_SHORT=$Env:CI_SHA_SHORT"
echo "CI_SHA=$Env:CI_SHA"
echo "CI_PR_NUMBER=$Env:CI_PR_NUMBER"
echo "CI_PR_ID=$Env:CI_PR_ID"
echo "CI_PR_TITLE=$Env:CI_PR_TITLE"
echo "CI_PR_DESCRIPTION=$Env:CI_PR_DESCRIPTION"
echo "CI_ACTOR=$Env:CI_ACTOR"
@ -122,6 +126,8 @@ jobs:
echo "CI_BASE_REF=$CI_BASE_REF"
echo "CI_SHA_SHORT=$CI_SHA_SHORT"
echo "CI_SHA=$CI_SHA"
echo "CI_PR_NUMBER=$CI_PR_NUMBER"
echo "CI_PR_ID=$CI_PR_ID"
echo "CI_PR_TITLE=$CI_PR_TITLE"
echo "CI_PR_DESCRIPTION=$CI_PR_DESCRIPTION"
echo "CI_ACTOR=$CI_ACTOR"

View file

@ -2,7 +2,7 @@
[![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)
[![Demo: available](https://img.shields.io/badge/Demo-available-orange)](.github/workflows/demo.yml)
[![Version: v2.3.1](https://img.shields.io/badge/Version-v2.3.1-brightgreen)](https://github.com/FranzDiebold/github-env-vars-action/releases/tag/v2.3.1)
[![Version: v2.4.0](https://img.shields.io/badge/Version-v2.4.0-brightgreen)](https://github.com/FranzDiebold/github-env-vars-action/releases/tag/v2.4.0)
[![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)
[![license: MIT](https://img.shields.io/badge/license-MIT-brightgreen.svg)](./LICENSE)
@ -30,6 +30,8 @@ A [GitHub Action](https://github.com/features/actions) to expose useful environm
| `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` |
| `CI_SHA_SHORT` | The shortened commit SHA (8 characters) that triggered the workflow. | `ffac537e` |
| `CI_SHA` | The commit SHA that triggered the workflow. Copy of `GITHUB_SHA` - for reasons of completeness. | `ffac537e6cbbf934b08745a378932722df287a53` |
| `CI_PR_NUMBER` | The number of the pull request. Only set for pull requests. | `42` |
| `CI_PR_ID` | Copy of `CI_PR_NUMBER` for completeness. | `42` |
| `CI_PR_TITLE` | The title of the pull request. Only set for pull requests. | `Add feature xyz.` |
| `CI_PR_DESCRIPTION` | The description of the pull request. Only set for pull requests. | `The feature xyz is the [...]` |
| `CI_ACTOR` | The name of the person or app that initiated the workflow. Copy of `GITHUB_ACTOR` - for reasons of completeness. | `octocat` |

983
dist/index.js vendored

File diff suppressed because it is too large Load diff

View file

@ -186,6 +186,13 @@ try {
const pullRequest = github.context.payload &&
github.context.payload.pull_request;
if (pullRequest) {
const prNumber = pullRequest.number;
core.exportVariable('CI_PR_NUMBER', prNumber);
core.info(`Set CI_PR_NUMBER=${process.env.CI_PR_NUMBER}`);
core.exportVariable('CI_PR_ID', prNumber);
core.info(`Set CI_PR_ID=${process.env.CI_PR_ID}`);
const prTitle = pullRequest.title;
core.exportVariable('CI_PR_TITLE', prTitle);
core.info(`Set CI_PR_TITLE=${process.env.CI_PR_TITLE}`);

4238
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
{
"name": "github-env-vars-action",
"version": "2.3.1",
"version": "2.4.0",
"description": "A GitHub Action to expose useful environment variables.",
"main": "index.js",
"scripts": {
@ -23,13 +23,13 @@
},
"homepage": "https://github.com/FranzDiebold/github-env-vars-action#readme",
"dependencies": {
"@actions/core": "^1.6.0",
"@actions/github": "^5.0.0"
"@actions/core": "^1.9.0",
"@actions/github": "^5.0.3"
},
"devDependencies": {
"@vercel/ncc": "^0.33.1",
"eslint": "^8.7.0",
"@vercel/ncc": "^0.34.0",
"eslint": "^8.19.0",
"eslint-config-google": "^0.14.0",
"jest": "^27.4.7"
"jest": "^28.1.2"
}
}