Skip to content

Commit 3a80404

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 3a80404

File tree

1 file changed

+73
-0
lines changed

1 file changed

+73
-0
lines changed
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
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+
CODEQL: ${{ steps.init.outputs.codeql-path }}
57+
RESOLVED_LANGUAGES_FILE: ../action/src/resolved-languages.json
58+
run: |
59+
if [ ! -f "${RESOLVED_LANGUAGES_FILE}" ]; then
60+
echo "::error file=resolved-languages.json::The resolved-languages.json file is missing."
61+
exit 1
62+
fi
63+
"${CODEQL}" resolve languages --format=betterjson --extractor-include-aliases > resolved-languages.json
64+
if ! diff -u resolved-languages.json "${RESOLVED_LANGUAGES_FILE}"; then
65+
echo "::error file=resolved-languages.json::The saved resolved-languages.json file is out of date."
66+
exit 1
67+
fi
68+
- name: Upload resolved languages file for debugging
69+
uses: actions/upload-artifact@v3
70+
with:
71+
name: resolved-languages.json
72+
env:
73+
CODEQL_ACTION_TEST_MODE: true

0 commit comments

Comments
 (0)