Skip to content

Commit ba8a1f9

Browse files
author
IvanZosimov
committed
Update action to use reusable workflows
1 parent 09d024b commit ba8a1f9

File tree

5 files changed

+15
-134
lines changed

5 files changed

+15
-134
lines changed

Diff for: .github/workflows/check-dist.yml

+3-39
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
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.
61
name: Check dist/
7-
82
on:
93
push:
104
branches:
@@ -17,36 +11,6 @@ on:
1711
workflow_dispatch:
1812

1913
jobs:
20-
check-dist:
21-
runs-on: ubuntu-latest
22-
23-
steps:
24-
- uses: actions/checkout@v3
25-
26-
- name: Set Node.js 16
27-
uses: actions/setup-node@v3
28-
with:
29-
node-version: 16.x
30-
cache: npm
31-
32-
- name: Install dependencies
33-
run: npm ci --ignore-scripts
34-
35-
- name: Rebuild the dist/ directory
36-
run: npm run build
37-
38-
- name: Compare the expected and actual dist/ directories
39-
run: |
40-
if [ "$(git diff --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then
41-
echo "Detected uncommitted changes after build. See status below:"
42-
git diff
43-
exit 1
44-
fi
45-
id: diff
46-
47-
# If index.js was different than expected, upload the expected version as an artifact
48-
- uses: actions/upload-artifact@v3
49-
if: ${{ failure() && steps.diff.conclusion == 'failure' }}
50-
with:
51-
name: dist
52-
path: dist/
14+
call-check-dist:
15+
name: Check dist/
16+
uses: actions/reusable-workflows/.github/workflows/check-dist.yml@main

Diff for: .github/workflows/codeql-analysis.yml

+5-61
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,14 @@
1-
# For most projects, this workflow file will not need changing; you simply need
2-
# to commit it to your repository.
3-
#
4-
# You may wish to alter this file to override the set of languages analyzed,
5-
# or to provide custom queries or build logic.
6-
#
7-
# ******** NOTE ********
8-
# We have attempted to detect the languages in your repository. Please check
9-
# the `language` matrix defined below to confirm you have the correct set of
10-
# supported CodeQL languages.
11-
#
12-
name: "CodeQL"
13-
1+
name: CodeQL analysis
142
on:
153
push:
164
branches: [ main ]
175
pull_request:
18-
# The branches below must be a subset of the branches above
196
branches: [ main ]
207
schedule:
218
- cron: '23 19 * * 0'
9+
workflow_dispatch:
2210

2311
jobs:
24-
analyze:
25-
name: Analyze
26-
runs-on: ubuntu-latest
27-
permissions:
28-
actions: read
29-
contents: read
30-
security-events: write
31-
32-
strategy:
33-
fail-fast: false
34-
matrix:
35-
language: [ 'javascript' ]
36-
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
37-
# Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
38-
39-
steps:
40-
- name: Checkout repository
41-
uses: actions/checkout@v3
42-
43-
# Initializes the CodeQL tools for scanning.
44-
- name: Initialize CodeQL
45-
uses: github/codeql-action/init@v2
46-
with:
47-
languages: ${{ matrix.language }}
48-
# If you wish to specify custom queries, you can do so here or in a config file.
49-
# By default, queries listed here will override any specified in a config file.
50-
# Prefix the list here with "+" to use these queries and those in the config file.
51-
# queries: ./path/to/local/query, your-org/your-repo/queries@main
52-
53-
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
54-
# If this step fails, then you should remove it and run the build manually (see below)
55-
- name: Autobuild
56-
uses: github/codeql-action/autobuild@v2
57-
58-
# ℹ️ Command-line programs to run using the OS shell.
59-
# 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
60-
61-
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
62-
# and modify them (or add more) to build your code if your project
63-
# uses a compiled language
64-
65-
#- run: |
66-
# make bootstrap
67-
# make release
68-
69-
- name: Perform CodeQL Analysis
70-
uses: github/codeql-action/analyze@v2
12+
call-codeQL-analysis:
13+
name: CodeQL analysis
14+
uses: actions/reusable-workflows/.github/workflows/codeql-analysis.yml@main

Diff for: .github/workflows/licensed.yml

+3-13
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,6 @@ on:
1010
workflow_dispatch:
1111

1212
jobs:
13-
test:
14-
runs-on: ubuntu-latest
15-
name: Check licenses
16-
steps:
17-
- uses: actions/checkout@v3
18-
- run: npm ci --ignore-scripts
19-
- name: Install licensed
20-
run: |
21-
cd $RUNNER_TEMP
22-
curl -Lfs -o licensed.tar.gz https://github.com/github/licensed/releases/download/3.4.4/licensed-3.4.4-linux-x64.tar.gz
23-
sudo tar -xzf licensed.tar.gz
24-
sudo mv licensed /usr/local/bin/licensed
25-
- run: licensed status
13+
call-licensed:
14+
name: Licensed
15+
uses: actions/reusable-workflows/.github/workflows/licensed.yml@main

Diff for: .github/workflows/workflow.yml

+3-21
Original file line numberDiff line numberDiff line change
@@ -12,27 +12,9 @@ on:
1212
- '**.md'
1313

1414
jobs:
15-
build:
16-
runs-on: ${{ matrix.operating-system }}
17-
strategy:
18-
fail-fast: false
19-
matrix:
20-
operating-system: [ubuntu-latest, windows-latest, macOS-latest]
21-
steps:
22-
- name: Checkout
23-
uses: actions/checkout@v3
24-
- name: Set Node.js 16
25-
uses: actions/setup-node@v3
26-
with:
27-
node-version: 16.x
28-
cache: npm
29-
- run: npm ci --ignore-scripts
30-
- run: npm run build
31-
- run: npm run format-check
32-
- run: npm test
33-
- name: Verify no unstaged changes
34-
if: runner.os != 'windows'
35-
run: __tests__/verify-no-unstaged-changes.sh
15+
call-basic-validation:
16+
name: Basic validation
17+
uses: actions/reusable-workflows/.github/workflows/basic-validation.yml@main
3618

3719
test-setup-multiple-versions:
3820
runs-on: ${{ matrix.operating-system }}

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"build": "tsc && ncc build",
99
"format": "prettier --write **/*.ts",
1010
"format-check": "prettier --check **/*.ts",
11+
"lint": "",
1112
"prepare": "husky install",
1213
"test": "jest --coverage --config ./jest.config.js",
1314
"update-installers": "nwget https://dot.net/v1/dotnet-install.ps1 -O externals/install-dotnet.ps1 && nwget https://dot.net/v1/dotnet-install.sh -O externals/install-dotnet.sh"

0 commit comments

Comments
 (0)