Skip to content

Commit d2d866e

Browse files
committed
Add validate-resolved-languages.yml
This workflow checks that src/resolved-languages.json exists and is up-to-date with respect to the default (linked) CodeQL version.
1 parent aa90e97 commit d2d866e

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Validate Resolved Languages File
2+
env:
3+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4+
GO111MODULE: auto
5+
on:
6+
push:
7+
branches:
8+
- main
9+
- releases/v*
10+
pull_request:
11+
types:
12+
- opened
13+
- synchronize
14+
- reopened
15+
- ready_for_review
16+
schedule:
17+
- cron: '0 5 * * *'
18+
workflow_dispatch:
19+
inputs: {}
20+
workflow_call:
21+
inputs: {}
22+
defaults:
23+
run:
24+
shell: bash
25+
jobs:
26+
validate-resolved-languages:
27+
name: Validate Resolved Languages File
28+
permissions:
29+
contents: read
30+
timeout-minutes: 10
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Check out repository
34+
uses: actions/checkout@v5
35+
- name: Install Node.js
36+
uses: actions/setup-node@v4
37+
with:
38+
node-version: 20.x
39+
cache: npm
40+
- name: Install dependencies
41+
run: npm ci
42+
- name: Prepare test
43+
id: prepare-test
44+
uses: ./.github/actions/prepare-test
45+
with:
46+
version: linked
47+
use-all-platform-bundle: 'false'
48+
setup-kotlin: 'false'
49+
- name: Initialize CodeQL
50+
id: init
51+
uses: ./../action/init
52+
with:
53+
tools: ${{ steps.prepare-test.outputs.tools-url }}
54+
- name: Verify that the resolved languages file is up to date
55+
env:
56+
RESOLVED_LANGUAGES_FILE: ../action/src/resolved-languages.json
57+
run: |
58+
if [ ! -f "${RESOLVED_LANGUAGES_FILE}" ]; then
59+
echo "::error file=resolved-languages.json::The resolved-languages.json file is missing."
60+
exit 0
61+
fi
62+
${{ steps.init.outputs.codeql-path }} resolve languages --format=betterjson --extractor-include-aliases > resolved-languages.json
63+
diff -u resolved-languages.json "${RESOLVED_LANGUAGES_FILE}"
64+
if [ $? -ne 0 ]; then
65+
echo "::error file=resolved-languages.json::The saved resolved-languages.json file is out of date."
66+
exit 1
67+
fi
68+
env:
69+
CODEQL_ACTION_TEST_MODE: true

0 commit comments

Comments
 (0)