Skip to content

Commit

Permalink
fix: cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thomasrockhu-codecov committed Apr 30, 2024
1 parent c690ee9 commit 2189dc5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
4 changes: 0 additions & 4 deletions .github/workflows/main.yml
Expand Up @@ -9,10 +9,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4.1.4
- name: Dump GitHub context
env:
GITHUB_CONTEXT: ${{ toJSON(github) }}
run: echo "$GITHUB_CONTEXT"
- name: Install dependencies
run: npm install
- name: Lint
Expand Down
9 changes: 5 additions & 4 deletions dist/index.js
Expand Up @@ -32563,15 +32563,16 @@ const getGitService = () => {
return 'github';
};
const isFork = () => {
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(`base: ${baseLabel} | head: ${headLabel}`);
core.info(`baseRef: ${baseLabel} | headRef: ${headLabel}`);
return (baseLabel.split(':')[0] !== headLabel.split(':')[0]);
};
const getToken = () => buildExec_awaiter(void 0, void 0, void 0, function* () {
const baseLabel = context.payload.pull_request.base.label;
const headLabel = context.payload.pull_request.head.label;
core.info(`base: ${baseLabel} | head: ${headLabel}`);
if (isFork()) {
core.info('==> Fork detected, tokenless uploading used');
return Promise.resolve('');
Expand Down
2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

13 changes: 8 additions & 5 deletions src/buildExec.ts
Expand Up @@ -30,18 +30,21 @@ const getGitService = (): string => {
};

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;

Check warning on line 41 in src/buildExec.ts

View check run for this annotation

Codecov / codecov/patch

src/buildExec.ts#L40-L41

Added lines #L40 - L41 were not covered by tests

core.info(`base: ${baseLabel} | head: ${headLabel}`);
core.info(`baseRef: ${baseLabel} | headRef: ${headLabel}`);
return (baseLabel.split(':')[0] !== headLabel.split(':')[0]);

Check warning on line 44 in src/buildExec.ts

View check run for this annotation

Codecov / codecov/patch

src/buildExec.ts#L43-L44

Added lines #L43 - L44 were not covered by tests
};

const getToken = async (): Promise<string> => {
const baseLabel = context.payload.pull_request.base.label;
const headLabel = context.payload.pull_request.head.label;

core.info(`base: ${baseLabel} | head: ${headLabel}`);
if (isFork()) {
core.info('==> Fork detected, tokenless uploading used');
return Promise.resolve('');

Check warning on line 50 in src/buildExec.ts

View check run for this annotation

Codecov / codecov/patch

src/buildExec.ts#L49-L50

Added lines #L49 - L50 were not covered by tests
Expand Down

0 comments on commit 2189dc5

Please sign in to comment.