Files
shields/services/codecov/codecov-redirect.service.js
Caleb Cartwright 6e84e9b317 Refactor [Codecov] (#3074)
* feat: started refactoring codecov

* tests: removed erroneous test from draft PR

* chore: prettified for prettier

* feat: more codecov updates and tests

* feat: more codecov refactor updates

* feat: added codecov redirect content

* refactor: removed legacy codecov service file

* refactor(codecov): added redirect for legacy token route path

* docs(codecov): added documentation to examples for token info

* docs(codecov): updated vcs param in example patterns

* refactor(codecov): update redirect service date

Co-Authored-By: calebcartwright <calebcartwright@users.noreply.github.com>

* refactor(codecov): various updates based on PR feedback

* chore: added comment to codecov 401 test
2019-03-07 23:11:41 -06:00

27 lines
648 B
JavaScript

'use strict'
const { redirector } = require('..')
const vcsSNameShortFormMap = {
bb: 'bitbucket',
gh: 'github',
gl: 'gitlab',
}
module.exports = [
redirector({
category: 'coverage',
route: {
base: 'codecov/c',
pattern:
'token/:token/:vcsName(github|gh|bitbucket|bb|gl|gitlab)/:user/:repo/:branch*',
},
transformPath: ({ vcsName, user, repo, branch }) => {
const vcs = vcsSNameShortFormMap[vcsName] || vcsName
return `/codecov/c/${vcs}/${user}/${repo}${branch ? `/${branch}` : ''}`
},
transformQueryParams: ({ token }) => ({ token }),
dateAdded: new Date('2019-03-04'),
}),
]