mirror of
https://github.com/codecov/codecov-action.git
synced 2026-04-08 15:30:05 +00:00
fix: bypass token checks for forks and OIDC (#1404)
* chore(log): dump context * fix: add logic to bypass token for forks * fix: running the same things * fix: more logging * fix: more core info * fix: run the func * fix: cleanup
This commit is contained in:
parent
dad251dcaf
commit
5a299d1127
3 changed files with 57 additions and 25 deletions
|
|
@ -29,11 +29,29 @@ const getGitService = (): string => {
|
|||
return 'github';
|
||||
};
|
||||
|
||||
const isFork = (): boolean => {
|
||||
if (
|
||||
`${context.eventName}` !== 'pull_request' ||
|
||||
`${context.eventName}` !== 'pull_request_target'
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const baseLabel = context.payload.pull_request.base.label;
|
||||
const headLabel = context.payload.pull_request.head.label;
|
||||
|
||||
core.info(`baseRef: ${baseLabel} | headRef: ${headLabel}`);
|
||||
return (baseLabel.split(':')[0] !== headLabel.split(':')[0]);
|
||||
};
|
||||
|
||||
const getToken = async (): Promise<string> => {
|
||||
if (isFork()) {
|
||||
core.info('==> Fork detected, tokenless uploading used');
|
||||
return Promise.resolve('');
|
||||
}
|
||||
let token = core.getInput('token');
|
||||
let url = core.getInput('url');
|
||||
const useOIDC = isTrue(core.getInput('use_oidc'));
|
||||
|
||||
if (useOIDC) {
|
||||
if (!url) {
|
||||
url = 'https://codecov.io';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue