Skip to content

Commit

Permalink
PR check: Check toolcache empty at start
Browse files Browse the repository at this point in the history
  • Loading branch information
Henry Mercer committed Dec 3, 2024
1 parent 8c0517f commit f8ccf38
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/__extract-direct-to-toolcache.yml

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

15 changes: 12 additions & 3 deletions pr-checks/checks/extract-direct-to-toolcache.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ steps:
const path = require('path');
const codeqlPath = path.join(process.env['RUNNER_TOOL_CACHE'], 'CodeQL');
fs.rmdirSync(codeqlPath, { recursive: true });
- name: Install @actions/tool-cache
run: npm install @actions/tool-cache
- name: Check toolcache does not contain CodeQL
uses: actions/github-script@v7
with:
script: |
const toolcache = require('@actions/tool-cache');
const allCodeqlVersions = toolcache.findAllVersions('CodeQL');
if (allCodeqlVersions.length !== 0) {
throw new Error(`CodeQL should not be found in the toolcache, but found ${allCodeqlVersions}`);
}
console.log('No versions of CodeQL found in the toolcache');
- id: init
uses: ./../action/init
with:
Expand All @@ -26,8 +38,6 @@ steps:
with:
output: ${{ runner.temp }}/results
upload-database: false
- name: Install @actions/tool-cache
run: npm install @actions/tool-cache
- name: Check CodeQL is installed within the toolcache
uses: actions/github-script@v7
with:
Expand All @@ -41,4 +51,3 @@ steps:
if (allCodeqlVersions.length > 1) {
throw new Error('Multiple CodeQL versions found in toolcache');
}
console.log(`CodeQL version: ${allCodeqlVersions[0]}`);

0 comments on commit f8ccf38

Please sign in to comment.