-
Notifications
You must be signed in to change notification settings - Fork 0
61 lines (54 loc) · 1.72 KB
/
verify-build.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Node.js CI
on: [ pull_request ]
jobs:
build:
name: Check built files
runs-on: ubuntu-latest
steps:
- name: Checkout project
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Setup Node.js LTS
uses: actions/setup-node@v4
with:
node-version: 'lts/*'
- name: Install latest NPM
run: npm install -g npm
- name: Install project dependencies
run: npm ci
- name: Run build process(es)
run: |
npm run build
- name: Check Git status
id: git
shell: bash
run: |
RESULT=$(git status)
RESULT="${RESULT//'%'/'%25'}"
RESULT="${RESULT//$'\n'/'%0A'}"
RESULT="${RESULT//$'\r'/'%0D'}"
echo "::set-output name=changes::$RESULT"
echo "::set-output name=nodeVersion::$(node --version)"
echo "::set-output name=npmVersion::$(npm --version)"
if [[ $RESULT == *"Changes not staged"* || $RESULT == *"Untracked files"* ]]; then
exit 1
fi
- name: Comment on pull request
if: failure()
uses: actions/github-script@v7
with:
script: |
const output = `Changed files were detected after build. Please run project build workflows and check \`git status\` for any missed changes.
\`\`\`
${{ steps.git.outputs.changes }}
\`\`\`
You may need to update your local NPM configuration if different than below:
* Node ${{ steps.git.outputs.nodeVersion }}
* NPM ${{ steps.git.outputs.npmVersion }}
`;
github.issues.createComment({
...context.repo,
issue_number: context.payload.pull_request.number,
body: output
})