Skip to content

Commit

Permalink
Update action code
Browse files Browse the repository at this point in the history
  • Loading branch information
arikmaor committed May 7, 2022
1 parent a8f8b86 commit 899b12c
Show file tree
Hide file tree
Showing 7 changed files with 9,159 additions and 199 deletions.
18 changes: 3 additions & 15 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,10 @@ import * as cp from 'child_process'
import * as path from 'path'
import {expect, test} from '@jest/globals'

test('throws invalid number', async () => {
const input = parseInt('foo', 10)
await expect(wait(input)).rejects.toThrow('milliseconds not a number')
})

test('wait 500 ms', async () => {
const start = new Date()
await wait(500)
const end = new Date()
var delta = Math.abs(end.getTime() - start.getTime())
expect(delta).toBeGreaterThan(450)
})

// shows how the runner will run a javascript action with env / stdout protocol
test('test runs', () => {
process.env['INPUT_MILLISECONDS'] = '500'
process.env['GITHUB_REPOSITORY'] = 'arikmaor/commits-range-action'
process.env['INPUT_BASE_REVISION'] = 'HEAD^^^'
process.env['INPUT_HEAD_REVISION'] = 'HEAD'
const np = process.execPath
const ip = path.join(__dirname, '..', 'lib', 'main.js')
const options: cp.ExecFileSyncOptions = {
Expand Down
12 changes: 6 additions & 6 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ name: Commits Range Action
description: Gets a range of commits and their related pull requests
author: Arik Maor
inputs:
deployed_revision:
base_revision:
required: true
description: Revision (commit) at the start of the range.
next_revision:
description: Base revision (commit) of the range.
head_revision:
required: false
description: Revision (commit) at the end of the range (defaults to the commit in the workflow context).
description: Head revision (commit) of the range (defaults to the head commit of the workflow context).
outputs:
new_commits:
description: Commits included in the next revision that aren't included in the deployed revision
description: Commits included in the head revision that aren't included in the base revision
removed_commits:
description: Commits include in the deployed revision that aren't included in the next revision
description: Commits include in the base revision that aren't included in the head revision
new_prs:
description: Pull requests related to new commits
removed_prs:
Expand Down
Loading

0 comments on commit 899b12c

Please sign in to comment.