Change to node 20 #18
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "👀 Build and Test" | |
on: | |
workflow_dispatch: | |
pull_request: | |
types: ["opened", "synchronize"] | |
paths-ignore: | |
- "**.md" | |
push: | |
branches: | |
- "main" | |
- "releases/*" | |
paths-ignore: | |
- "**.md" | |
concurrency: | |
group: ${{ github.workflow }} | |
cancel-in-progress: true | |
jobs: | |
build: | |
name: "Build" | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Setup node" | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20 | |
- name: "Checkout" | |
uses: actions/checkout@v4 | |
- name: "Install dependencies" | |
run: npm ci | |
- name: "Rebuild the index.js file" | |
run: npm run build | |
- name: "Format check" | |
run: npm run format-check | |
- name: Audit npm for vulnerabilities | |
run: npm shrinkwrap && npm audit | |
- name: "Lint check" | |
run: npm run lint | |
- name: "Package" | |
run: npm run package | |
- name: "Test package" | |
run: npm test | |
- name: "Verify changes" | |
id: diff | |
run: | | |
if [ "$(git diff --diff-algorithm=minimal --ignore-cr-at-eol --ignore-space-at-eol dist/ | wc -l)" -gt "0" ]; then | |
echo "::warning::Detected uncommitted changes after build." | |
echo "::warning::Remember to run 'npm run all' to update 'dist/index.js' and include it in the commit." | |
git status | |
git diff --diff-algorithm=minimal --ignore-cr-at-eol --ignore-space-at-eol --exit-code | |
else | |
echo "No changes detected" | |
fi | |
- name: "Upload dist if failure" | |
uses: actions/upload-artifact@v3 | |
if: failure() && steps.diff.conclusion == 'failure' | |
with: | |
name: dist | |
path: dist/ | |
test: | |
name: "Test" | |
strategy: | |
matrix: | |
runs-on: ["ubuntu-latest", "macos-latest", "windows-latest"] | |
runs-on: ${{ matrix.runs-on }} | |
steps: | |
- name: "Checkout" | |
if: vars.TEST_GITHUB_APP_ID != '' | |
uses: actions/checkout@v4 | |
- name: "Generate token" | |
id: generate_token | |
if: vars.TEST_GITHUB_APP_ID != '' | |
uses: ./ | |
with: | |
app_id: ${{ vars.TEST_GITHUB_APP_ID }} | |
private_key: ${{ secrets.TEST_GITHUB_APP_PRIVATE_KEY }} | |
- name: "Check token length" | |
if: steps.generate_token.outcome != 'skipped' | |
run: node --eval "assert('${{ steps.generate_token.outputs.token }}'.length > 0);" |