Skip to content

Commit

Permalink
Merge pull request #1192 from github/update-v2.1.19-5502fefd
Browse files Browse the repository at this point in the history
Merge main into releases/v2
  • Loading branch information
henrymercer authored Aug 19, 2022
2 parents 2ca79b6 + 7c3d74c commit f5d217b
Show file tree
Hide file tree
Showing 1,923 changed files with 215,132 additions and 1,633 deletions.
60 changes: 60 additions & 0 deletions .github/check-codescanning-config/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Check Code-Scanning Config
description: |
Checks the code scanning configuration file generated by the
action to ensure it contains the expected contents
inputs:
languages:
required: false
description: The languages field passed to the init action.

packs:
required: false
description: The packs field passed to the init action.

queries:
required: false
description: The queries field passed to the init action.

config-file-test:
required: false
description: |
The location of the config file to use. If empty,
then no config file is used.
expected-config-file-contents:
required: true
description: |
A JSON string containing the exact contents of the config file.
tools:
required: true
description: |
The url of codeql to use.
runs:
using: composite
steps:
- uses: ./../action/init
with:
languages: ${{ inputs.languages }}
config-file: ${{ inputs.config-file-test }}
queries: ${{ inputs.queries }}
packs: ${{ inputs.packs }}
tools: ${{ inputs.tools }}
db-location: ${{ runner.temp }}/codescanning-config-cli-test

- name: Install dependencies
shell: bash
run: npm install --location=global ts-node js-yaml

- name: Check config
working-directory: ${{ github.action_path }}
shell: bash
run: ts-node ./index.ts "${{ runner.temp }}/user-config.yaml" '${{ inputs.expected-config-file-contents }}'

- name: Clean up
shell: bash
if: always()
run: |
rm -rf ${{ runner.temp }}/codescanning-config-cli-test
rm -rf ${{ runner.temp }}/user-config.yaml
39 changes: 39 additions & 0 deletions .github/check-codescanning-config/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

import * as core from '@actions/core'
import * as yaml from 'js-yaml'
import * as fs from 'fs'
import * as assert from 'assert'

const actualConfig = loadActualConfig()

const rawExpectedConfig = process.argv[3].trim()
if (!rawExpectedConfig) {
core.info('No expected configuration provided')
} else {
core.startGroup('Expected generated user config')
core.info(yaml.dump(JSON.parse(rawExpectedConfig)))
core.endGroup()
}

const expectedConfig = rawExpectedConfig ? JSON.parse(rawExpectedConfig) : undefined;

assert.deepStrictEqual(
actualConfig,
expectedConfig,
'Expected configuration does not match actual configuration'
);


function loadActualConfig() {
if (!fs.existsSync(process.argv[2])) {
core.info('No configuration file found')
return undefined
} else {
const rawActualConfig = fs.readFileSync(process.argv[2], 'utf8')
core.startGroup('Actual generated user config')
core.info(rawActualConfig)
core.endGroup()

return yaml.load(rawActualConfig)
}
}
6 changes: 4 additions & 2 deletions .github/query-filter-test/action.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: Query Filter Test
description: Runs a test of query filters using the check sarif action
description: Runs a test of query filters using the check SARIF action
inputs:
sarif-file:
required: true
Expand Down Expand Up @@ -34,6 +34,8 @@ runs:
config-file: ${{ inputs.config-file }}
tools: ${{ inputs.tools }}
db-location: ${{ runner.temp }}/query-filter-test
env:
TEST_MODE: "true"
- uses: ./../action/analyze
with:
output: ${{ runner.temp }}/results
Expand All @@ -49,4 +51,4 @@ runs:
queries-not-run: ${{ inputs.queries-not-run}}
- name: Cleanup after test
shell: bash
run: rm -rf "$RUNNER_TEMP/results" "$RUNNER_TEMP//query-filter-test"
run: rm -rf "$RUNNER_TEMP/results" "$RUNNER_TEMP/query-filter-test"
2 changes: 2 additions & 0 deletions .github/workflows/__analyze-ref-input.yml

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

2 changes: 2 additions & 0 deletions .github/workflows/__autobuild-action.yml

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

96 changes: 0 additions & 96 deletions .github/workflows/__debug-artifacts.yml

This file was deleted.

2 changes: 2 additions & 0 deletions .github/workflows/__extractor-ram-threads.yml

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

2 changes: 2 additions & 0 deletions .github/workflows/__go-custom-queries.yml

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

2 changes: 2 additions & 0 deletions .github/workflows/__go-custom-tracing-autobuild.yml

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

2 changes: 2 additions & 0 deletions .github/workflows/__go-custom-tracing.yml

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

2 changes: 2 additions & 0 deletions .github/workflows/__javascript-source-root.yml

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

11 changes: 11 additions & 0 deletions .github/workflows/__ml-powered-queries.yml

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

2 changes: 2 additions & 0 deletions .github/workflows/__multi-language-autodetect.yml

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

Loading

0 comments on commit f5d217b

Please sign in to comment.