Skip to content

Commit

Permalink
ncu
Browse files Browse the repository at this point in the history
  • Loading branch information
retorquere committed Nov 10, 2020
1 parent 6e53f3c commit 59bb1f8
Show file tree
Hide file tree
Showing 3 changed files with 358 additions and 2,654 deletions.
10 changes: 9 additions & 1 deletion continuous-integration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class ContinuousIntegrationSingleton {
public pull_request = false

constructor() {
for (const [id, name] of Object.entries({CIRCLECI: 'Circle', TRAVIS: 'Travis' , SEMAPHORE: 'Semaphore'})) {
for (const [id, name] of Object.entries({CIRCLECI: 'Circle', TRAVIS: 'Travis' , SEMAPHORE: 'Semaphore', GITHUB_ACTIONS: 'GitHub'})) {
if (process.env[id] === 'true') this.service = name
}

Expand All @@ -34,6 +34,14 @@ class ContinuousIntegrationSingleton {
this.pull_request = process.env.TRAVIS_PULL_REQUEST !== 'false'
break

case 'GitHub':
this.build_number = this.parseInt(process.env.GITHUB_RUN_NUMBER)
this.tag = process.env.GITHUB_REF.startsWith('refs/tags/') ? process.env.GITHUB_REF.split('/').pop() : null
this.commit_message = child_process.execSync(`git log --format=%B -n 1 ${process.env.GITHUB_SHA}`).toString().trim()
this.branch = process.env.GITHUB_REF.startsWith('refs/heads/') ? process.env.GITHUB_REF.split('/').pop() : null
this.pull_request = false // this needs looking into
break

case 'Semaphore':
this.build_number = child_process.execSync('git log -1 --pretty=format:%h').toString().trim()
this.tag = child_process.execSync('git tag -l --points-at $SEMAPHORE_GIT_SHA').toString().trim()
Expand Down

0 comments on commit 59bb1f8

Please sign in to comment.