File tree 1 file changed +51
-0
lines changed
1 file changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ # `dist/index.js` is a special file in Actions.
2
+ # When you reference an action with `uses:` in a workflow,
3
+ # `index.js` is the code that will run.
4
+ # For our project, we generate this file through a build process from other source files.
5
+ # We need to make sure the checked-in `index.js` actually matches what we expect it to be.
6
+ name : Check dist/
7
+
8
+ on :
9
+ push :
10
+ branches :
11
+ - main
12
+ paths-ignore :
13
+ - ' **.md'
14
+ pull_request :
15
+ paths-ignore :
16
+ - ' **.md'
17
+ workflow_dispatch :
18
+
19
+ jobs :
20
+ check-dist :
21
+ runs-on : ubuntu-latest
22
+
23
+ steps :
24
+ - uses : actions/checkout@v2
25
+
26
+ - name : Set Node.js 12.x
27
+ uses : actions/setup-node@v1
28
+ with :
29
+ node-version : 12.x
30
+
31
+ - name : Install dependencies
32
+ run : npm ci
33
+
34
+ - name : Rebuild the dist/ directory
35
+ run : npm run build
36
+
37
+ - name : Compare the expected and actual dist/ directories
38
+ run : |
39
+ if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
40
+ echo "Detected uncommitted changes after build. See status below:"
41
+ git diff
42
+ exit 1
43
+ fi
44
+ id : diff
45
+
46
+ # If index.js was different than expected, upload the expected version as an artifact
47
+ - uses : actions/upload-artifact@v2
48
+ if : ${{ failure() && steps.diff.conclusion == 'failure' }}
49
+ with :
50
+ name : dist
51
+ path : dist/
You can’t perform that action at this time.
0 commit comments