mirror of
https://github.com/dorny/paths-filter.git
synced 2025-06-07 16:49:03 +00:00
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:
parent
7d201829e2
commit
83deb9f037
8 changed files with 202 additions and 35 deletions
19
__tests__/git.test.ts
Normal file
19
__tests__/git.test.ts
Normal 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')
|
||||
})
|
||||
})
|
Loading…
Add table
Add a link
Reference in a new issue