Skip to content

Commit

Permalink
Add test mode
Browse files Browse the repository at this point in the history
  • Loading branch information
David Verdeguer committed May 8, 2020
1 parent baa9c9e commit c979850
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/integration-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ jobs:
shell: bash
run: ./build.sh
- uses: ./../action/analyze

env:
TEST_MODE: true

multi-language-repo/test-custom-queries:
strategy:
Expand All @@ -45,4 +46,6 @@ jobs:
- name: Build code
shell: bash
run: ./build.sh
- uses: ./../action/analyze
- uses: ./../action/analyze
env:
TEST_MODE: true
5 changes: 5 additions & 0 deletions lib/upload-lib.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/upload-lib.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,12 @@ export function combineSarifFiles(sarifFiles: string[]): string {
async function uploadPayload(payload): Promise<boolean> {
core.info('Uploading results');

// If in test mode we don't want to upload the results
const testMode = process.env['TEST_MODE'] === 'true' || false;
if (testMode) {
return true;
}

const githubToken = core.getInput('token');
const ph: auth.BearerCredentialHandler = new auth.BearerCredentialHandler(githubToken);
const client = new http.HttpClient('Code Scanning : Upload SARIF', [ph]);
Expand Down

0 comments on commit c979850

Please sign in to comment.