diff --git a/README.md b/README.md index 9af032f..c222b17 100644 --- a/README.md +++ b/README.md @@ -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` | diff --git a/index.js b/index.js index 0b5361e..36bbea4 100644 --- a/index.js +++ b/index.js @@ -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}`);