Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

A couple of fixes #61

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 0 additions & 21 deletions Dockerfile

This file was deleted.

12 changes: 12 additions & 0 deletions __mocks__/@actions/core.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
const fs = require('fs')
const yaml = require('js-yaml')

const content = fs.readFileSync(`${__dirname}/../../action.yml`, 'utf-8')
const config = yaml.safeLoad(content)

module.exports = {
getInput (name) {
return (config.inputs[name] || {}).default || ''
}
}

Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { runMain } from './TodoActionsMain'
import { resetMockWorld } from './__mocks__/World'
import { runMain } from '../src/TodoActionsMain'
import { resetMockWorld } from '../src/__mocks__/World'
import sortBy from 'lodash.sortby'

jest.mock('./DataStore')
jest.mock('./CodeRepository')
jest.mock('./TaskManagementSystem')
jest.mock('@actions/core')
jest.mock('../src/DataStore')
jest.mock('../src/CodeRepository')
jest.mock('../src/TaskManagementSystem')

const MARKER = 'TODO'

Expand Down Expand Up @@ -37,11 +38,11 @@ it('works', async () => {
expect(world.commits[1].files.get('main.js')).toMatch(
new RegExp(`${MARKER} \\[#\\d+\\]: Hello world`),
)

expect(world.commits[1].message).toMatch(/#1/)
expect(world.commits[1].message).toMatch(/#2/)

// Round 1: Assert tasks
expect(world.tasks.length).toEqual(2)
expect(sortBy(world.tasks.map(t => t.title))).toEqual([
'Hello world',
'Somebody once told me',
Expand Down
4 changes: 2 additions & 2 deletions src/TodoParser.test.ts → __tests__/TodoParser.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { parseTodos } from './TodoParser'
import { MockFile } from './File'
import { parseTodos } from '../src/TodoParser'
import { MockFile } from '../src/File'

const MARKER = 'TODO'

Expand Down
25 changes: 25 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: 'Todo Actions'
description: 'Convert TODO comments into issues'

inputs:
collect_commit_msg:
description: 'Commit message of collecting issues'
default: 'Collect TODO comments'
collect_commit_body:
description: 'Commit body of collecting issues'
default: ''

reference_commit_msg:
description: 'Commit message of referencing issues'
default: 'Update TODO references: %s'
reference_commit_body:
description: 'Commit body of referencing issues'
default: ''

branch:
description: 'Working branch'
default: 'master'

runs:
using: 'node12'
main: 'dist/index.js'
Binary file added dist/code-points.mem
Binary file not shown.
Loading