Skip to content

Fix actions/upload-artifact #20

Fix actions/upload-artifact

Fix actions/upload-artifact #20

Workflow file for this run

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@v4
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);"