Improve change detection for feature branches (#16)

* Detect changes against configured base branch

* Update README and action.yml

* Add job.outputs example

* Update CHANGELOG
This commit is contained in:
Michal Dorner 2020-06-24 21:53:31 +02:00 committed by GitHub
parent 7d201829e2
commit 83deb9f037
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 202 additions and 35 deletions

19
__tests__/git.test.ts Normal file
View file

@ -0,0 +1,19 @@
import * as git from '../src/git'
describe('git utility function tests (those not invoking git)', () => {
test('Detects if ref references a tag', () => {
expect(git.isTagRef('refs/tags/v1.0')).toBeTruthy()
expect(git.isTagRef('refs/heads/master')).toBeFalsy()
expect(git.isTagRef('master')).toBeFalsy()
})
test('Trims "refs/" from ref', () => {
expect(git.trimRefs('refs/heads/master')).toBe('heads/master')
expect(git.trimRefs('heads/master')).toBe('heads/master')
expect(git.trimRefs('master')).toBe('master')
})
test('Trims "refs/" and "heads/" from ref', () => {
expect(git.trimRefsHeads('refs/heads/master')).toBe('master')
expect(git.trimRefsHeads('heads/master')).toBe('master')
expect(git.trimRefsHeads('master')).toBe('master')
})
})