diff --git a/README.md b/README.md index 9e57402..04d9b14 100644 --- a/README.md +++ b/README.md @@ -78,7 +78,7 @@ if (isCI) { | [Codefresh](https://codefresh.io/docs/docs/codefresh-yaml/variables#system-provided-variables) | `codefresh` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | [Codeship](https://documentation.codeship.com/basic/builds-and-configuration/set-environment-variables/#default-environment-variables) | `codeship` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :x: | :x: | :x: | :x: | :white_check_mark: | :x: | | [Drone](https://readme.drone.io/reference/environ/) | `drone` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | -| [GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables) | `github` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :x: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | +| [GitHub Actions](https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables) | `github` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | [GitLab CI/CD](https://docs.gitlab.com/ce/ci/variables/README.html) | `gitlab` | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | | [Jenkins](https://wiki.jenkins.io/display/JENKINS/Building+a+software+project) | `jenkins` | :white_check_mark: | [:warning:](#jenkins) | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | [:warning:](#jenkins) | [:warning:](#jenkins) | [:warning:](#jenkins) | :white_check_mark: | :white_check_mark: | | [Netlify](https://docs.netlify.com/configure-builds/environment-variables/#netlify-configuration-variables) | `netlify` | :white_check_mark: | [:warning:](#netlify) | :white_check_mark: | :x: | :white_check_mark: | :white_check_mark: | :x: | :x: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | :white_check_mark: | diff --git a/services/github.js b/services/github.js index c02b819..a520e04 100644 --- a/services/github.js +++ b/services/github.js @@ -38,6 +38,7 @@ module.exports = { service: "github", commit: env.GITHUB_SHA, build: env.GITHUB_RUN_ID, + buildUrl: `${env.GITHUB_SERVER_URL}/${env.GITHUB_REPOSITORY}/runs/${env.GITHUB_RUN_ID}`, isPr, branch, prBranch: isPr ? branch : undefined, diff --git a/test/services/github.test.js b/test/services/github.test.js index e6bbf12..d62bfb3 100644 --- a/test/services/github.test.js +++ b/test/services/github.test.js @@ -12,6 +12,7 @@ const env = { GITHUB_REPOSITORY: 'owner/repo', GITHUB_WORKSPACE: '/workspace', GITHUB_RUN_ID: '1246789', + GITHUB_SERVER_URL: 'https://github.com', }; test('Push', (t) => { @@ -20,6 +21,7 @@ test('Push', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: 'master', isPr: false, prBranch: undefined, @@ -34,6 +36,7 @@ test('Push - with short branch name', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: 'master', isPr: false, prBranch: undefined, @@ -61,6 +64,7 @@ test('PR - with event.json file', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: 'master', isPr: true, prBranch: 'refs/pull/10/merge', @@ -90,6 +94,7 @@ test('PR - target', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: 'master', isPr: true, prBranch: 'refs/pull/10/merge', @@ -119,6 +124,7 @@ test('PR - with event.json file and short branch name', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: 'master', isPr: true, prBranch: 'refs/pull/10/merge', @@ -144,6 +150,7 @@ test('PR - with missing event.json file', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: undefined, isPr: true, prBranch: 'refs/pull/10/merge', @@ -165,6 +172,7 @@ test('PR - with missing event.json file path', (t) => { commit: '1234', build: '1246789', branch: undefined, + buildUrl: 'https://github.com/owner/repo/runs/1246789', isPr: true, prBranch: 'refs/pull/10/merge', pr: undefined, @@ -193,6 +201,7 @@ test('PR - with missing "pull_request" in event.json file', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: undefined, isPr: true, prBranch: 'refs/pull/10/merge', @@ -222,6 +231,7 @@ test('PR - with missing "pull_request.base" in event.json file', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: undefined, isPr: true, prBranch: 'refs/pull/10/merge', @@ -238,6 +248,7 @@ test('Push - with incorrect branch name', (t) => { service: 'github', commit: '1234', build: '1246789', + buildUrl: 'https://github.com/owner/repo/runs/1246789', branch: undefined, isPr: false, prBranch: undefined,