ci: add auto-approve workflow (github-actions bot) #126
This file contains hidden or 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: CI | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| security-events: write | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| ping: | |
| name: ping • ubuntu-latest | |
| runs-on: ubuntu-latest | |
| steps: | |
| - run: echo "ok" | |
| py: | |
| name: "py / ${{ matrix.python }} • ${{ matrix.os }}" | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| python: ["3.11", "3.12"] | |
| os: ["ubuntu-latest"] | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-python@v5 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - name: Smoke | |
| run: python -V | |
| # ci:nudge 20250917T164347Z | |
| ts: | |
| name: "ts / node 22.x • ubuntu-latest" | |
| runs-on: ubuntu-latest | |
| continue-on-error: true | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Detect Node workspace | |
| id: guard | |
| shell: bash | |
| run: | | |
| if find . -type f -name package.json -print -quit | grep -q .; then | |
| echo "HAS_NODE=1" >> "$GITHUB_ENV" | |
| else | |
| echo "HAS_NODE=0" >> "$GITHUB_ENV" | |
| fi | |
| - if: ${{ env.HAS_NODE == '1' }} | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22.x | |
| check-latest: false | |
| - if: ${{ env.HAS_NODE == '1' }} | |
| name: Prepare pnpm (best-effort) | |
| shell: bash | |
| run: | | |
| corepack enable || true | |
| corepack prepare pnpm@9 --activate || true | |
| pnpm --version || true | |
| - if: ${{ env.HAS_NODE == '1' }} | |
| name: Detect package manager | |
| id: pm | |
| shell: bash | |
| run: | | |
| if [ -f pnpm-lock.yaml ]; then echo "PM=pnpm" >> "$GITHUB_ENV"; | |
| elif [ -f package-lock.json ]; then echo "PM=npm" >> "$GITHUB_ENV"; | |
| elif [ -f yarn.lock ]; then echo "PM=yarn" >> "$GITHUB_ENV"; | |
| else echo "PM=none" >> "$GITHUB_ENV"; fi | |
| - if: ${{ env.HAS_NODE == '1' }} | |
| name: Install deps (best-effort) | |
| shell: bash | |
| run: | | |
| case "$PM" in | |
| pnpm) pnpm i --frozen-lockfile || true ;; | |
| npm) npm ci || true ;; | |
| yarn) corepack yarn install --immutable || true ;; | |
| *) echo "no lockfile" ;; | |
| esac | |
| - if: ${{ env.HAS_NODE == '1' }} | |
| name: Test smoke (best-effort) | |
| shell: bash | |
| run: | | |
| if [ -f package.json ] && node -e "p=require('./package.json');process.exit(p.scripts&&p.scripts.test?0:1)"; then | |
| case "$PM" in | |
| pnpm) pnpm -s test || true ;; | |
| npm) npm -s test || true ;; | |
| yarn) corepack yarn -s test || true ;; | |
| *) echo "no PM; skip test" ;; | |
| esac | |
| else | |
| echo "no tests" | |
| fi | |
| - if: ${{ env.HAS_NODE != '1' }} | |
| name: Skip (no package.json) | |
| run: | | |
| echo "skip ts: no Node workspace" |