Skip to content

Commit dc74db4

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 da96b2a commit dc74db4

File tree

1 file changed

+76
-0
lines changed

1 file changed

+76
-0
lines changed
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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+
security-events: read
31+
timeout-minutes: 10
32+
runs-on: ubuntu-latest
33+
steps:
34+
- name: Check out repository
35+
uses: actions/checkout@v5
36+
- name: Install Node.js
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: 20.x
40+
cache: npm
41+
- name: Install dependencies
42+
run: npm ci
43+
- name: Prepare test
44+
id: prepare-test
45+
uses: ./.github/actions/prepare-test
46+
with:
47+
version: linked
48+
use-all-platform-bundle: 'false'
49+
setup-kotlin: 'false'
50+
- name: Initialize CodeQL
51+
id: init
52+
uses: ./../action/init
53+
with:
54+
tools: ${{ steps.prepare-test.outputs.tools-url }}
55+
- name: Verify that the resolved languages file is up to date
56+
env:
57+
CODEQL: ${{ steps.init.outputs.codeql-path }}
58+
RESOLVED_LANGUAGES_FILE: ../action/src/resolved-languages.json
59+
run: |
60+
if [ ! -f "${RESOLVED_LANGUAGES_FILE}" ]; then
61+
echo "::error file=src/resolved-languages.json::The resolved-languages.json file is missing."
62+
exit 1
63+
fi
64+
"${CODEQL}" resolve languages --format=betterjson --extractor-include-aliases > resolved-languages.json
65+
if ! diff -u resolved-languages.json "${RESOLVED_LANGUAGES_FILE}"; then
66+
echo "::error file=src/resolved-languages.json::The saved resolved-languages.json file is out of date."
67+
exit 1
68+
fi
69+
- name: Upload resolved languages file for debugging
70+
if: ${{ failure() }}
71+
uses: actions/upload-artifact@v4
72+
with:
73+
name: resolved-languages
74+
path: resolved-languages.json
75+
env:
76+
CODEQL_ACTION_TEST_MODE: true

0 commit comments

Comments
 (0)