1- # In JavaScript actions, `dist/` is a special directory. When you reference
2- # an action with the `uses:` property, `dist/index.js` is the code that will be
3- # run. For this project, the `dist/index.js` file is transpiled from other
4- # source files. This workflow ensures the `dist/` directory contains the
5- # expected transpiled code.
6- #
7- # If this workflow is run from a feature branch, it will act as an additional CI
8- # check and fail if the checked-in `dist/` directory does not match what is
9- # expected from the build.
101name : Check Transpiled JavaScript
112
123on :
@@ -22,55 +13,36 @@ permissions:
2213
2314jobs :
2415 check-dist :
25- name : Check dist/
16+ name : Check dist/index.js
2617 runs-on : ubuntu-latest
27-
2818 steps :
29- # Checkout the repository.
3019 - name : Checkout
31- id : checkout
3220 uses : actions/checkout@v4
3321
34- # Setup Node.js using the version specified in `.node-version`.
35- - name : Setup Node.js
36- id : setup-node
37- uses : actions/setup-node@v4
22+ - name : Setup project
23+ uses : ./.github/actions/setup-project
3824 with :
39- node-version-file : .node-version
40- cache : npm
41-
42- # Install dependencies using `npm ci`.
43- - name : Install Dependencies
44- id : install
45- run : npm ci
46-
47- # Build the `dist/` directory.
48- - name : Build dist/ Directory
49- id : build
50- run : npm run bundle
25+ build : ' true'
5126
52- # This will fail the workflow if the `dist/` directory is different than
53- # expected.
54- - name : Compare Directories
55- id : diff
27+ - name : Check if dist/index.js exists
5628 run : |
57- if [ ! -d dist/ ]; then
58- echo "Expected dist/ directory does not exist. See status below:"
59- ls -la . /
29+ if [ ! -f actions/codeql-analyzer / dist/index.js ]; then
30+ echo "Expected dist/index.js does not exist. See status below:"
31+ ls -la actions/codeql-analyzer /dist /
6032 exit 1
6133 fi
62- if [ "$(git diff --ignore-space-at-eol --text dist/ | wc -l)" -gt "0" ]; then
63- echo "Detected uncommitted changes after build. See status below:"
64- git diff --ignore-space-at-eol --text dist/
34+
35+ - name : Compare dist/index.js
36+ run : |
37+ if [ "$(git diff --ignore-space-at-eol --text actions/codeql-analyzer /dist/index.js | wc -l)" -gt "0" ]; then
38+ echo "Detected uncommitted changes in dist/index.js after build. See diff below:"
39+ git diff --ignore-space-at-eol --text actions/codeql-analyzer /dist/index.js
6540 exit 1
6641 fi
6742
68- # If `dist/` was different than expected, upload the expected version as a
69- # workflow artifact.
70- - if : ${{ failure() && steps.diff.outcome == 'failure' }}
43+ - if : ${{ failure() }}
7144 name : Upload Artifact
72- id : upload
7345 uses : actions/upload-artifact@v4
7446 with :
75- name : dist
76- path : dist/
47+ name : codeql-analyzer - dist
48+ path : actions/codeql-analyzer / dist/
0 commit comments