Skip to content

Chore: update dependency eslint-plugin-unicorn to v66 #2523

Chore: update dependency eslint-plugin-unicorn to v66

Chore: update dependency eslint-plugin-unicorn to v66 #2523

name: Node.js Test Package
on:
pull_request:
types:
# Types run for by default
- opened
- reopened
- synchronize
# Merged
- closed
push:
branches:
- 'main'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
path-filter:
permissions:
pull-requests: read # dorny/paths-filter
runs-on: ubuntu-latest
outputs:
changes: ${{ steps.filter.outputs.changes }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- id: filter
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v4.0.1
with:
filters: |
changes:
- '.github/workflows/node-test-package.yml'
- 'packages/**'
- 'src/**'
- '*'
pkg-pr-new:
needs:
- path-filter
if: ${{ needs.path-filter.outputs.changes == 'true' }}
permissions:
contents: read # actions/checkout
runs-on: ubuntu-latest
outputs:
package_name: ${{ steps.pkg-pr-new.outputs.PACKAGE_NAME }}
package_url: ${{ steps.pkg-pr-new.outputs.PACKAGE_URL }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
submodules: 'recursive'
- uses: volta-cli/action@615a78f6c83e116339c53b94f3f82b4d6c0b7d18 # v5.0.0
- id: npm-cache-dir
shell: bash
run: echo "dir=$(npm config get cache)" >> "${GITHUB_OUTPUT}"
- uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5
with:
path: ${{ steps.npm-cache-dir.outputs.dir }}
key: ${{ runner.os }}-npm-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-npm-
${{ runner.os }}-
- id: pkg-pr-new
run: |
set -x
npm ci
npx --yes pkg-pr-new publish --compact --json pkg.json --comment=off
cat pkg.json
echo "PACKAGE_NAME=$(jq --raw-output '.packages[0].name' pkg.json)" >> "${GITHUB_OUTPUT}"
echo "PACKAGE_URL=$(jq --raw-output '.packages[0].url' pkg.json)" >> "${GITHUB_OUTPUT}"
test-npx:
name: test-npx (${{ matrix.os }})
needs:
- pkg-pr-new
if: ${{ startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' }}
permissions:
contents: read # actions/checkout
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-24.04-arm
- macos-latest
- macos-15-intel
- windows-latest
- windows-11-arm
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: volta-cli/action@615a78f6c83e116339c53b94f3f82b4d6c0b7d18 # v5.0.0
- run: |
npm exec --yes --foreground-scripts "${{ needs.pkg-pr-new.outputs.package_url }}" -- --help
# TODO(cemmer): bunx testing, https://github.com/oven-sh/bun/issues/17946
test-npm-install-global:
name: test-npm-install-global (${{ matrix.os }})
needs:
- pkg-pr-new
if: ${{ startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' }}
permissions:
contents: read # actions/checkout
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
- ubuntu-24.04-arm
- macos-latest
- macos-15-intel
- windows-latest
- windows-11-arm
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: volta-cli/action@615a78f6c83e116339c53b94f3f82b4d6c0b7d18 # v5.0.0
- shell: bash
run: |
set -x
npm install --global --foreground-scripts "${{ needs.pkg-pr-new.outputs.package_url }}"
PATH="$(npm get prefix --global)/bin:$PATH"
export PATH
igir --help
# !!! This check should be required by GitHub !!!
test-package-status-check:
needs:
- pkg-pr-new
- test-npx
- test-npm-install-global
if: always()
permissions: {}
runs-on: ubuntu-latest
steps:
- uses: re-actors/alls-green@05ac9388f0aebcb5727afa17fcccfecd6f8ec5fe # release/v1
with:
jobs: ${{ toJSON(needs) }}
allowed-skips: pkg-pr-new, test-npx, test-npm-install-global
npm-exec-branch-comment:
needs:
- pkg-pr-new
- test-npx
- test-npm-install-global
# TODO(cemmer): need pull_request_target to comment
if: ${{ github.event.pull_request.user.login == 'emmercm' && startsWith(github.event_name, 'pull_request') && github.event.action != 'closed' }}
permissions:
pull-requests: write # thollander/actions-comment-pull-request
runs-on: ubuntu-latest
steps:
- uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
message: |
## :test_tube: Package testing instructions
This pull request can be tested locally with the following command:
```shell
npx --yes "${{ needs.pkg-pr-new.outputs.package_url }}" [commands..] [options]
```
_Comment generated by the [${{ github.workflow }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}) workflow._
comment-tag: npm-exec
npm-exec-merge-comment:
needs:
- path-filter
# TODO(cemmer): need pull_request_target to comment
if: ${{ github.event.pull_request.user.login == 'emmercm' && needs.path-filter.outputs.changes == 'true' && startsWith(github.event_name, 'pull_request') && github.event.action == 'closed' && github.event.pull_request.merged && github.event.pull_request.base.ref == 'main' }}
permissions:
pull-requests: write # thollander/actions-comment-pull-request
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
persist-credentials: false
- uses: volta-cli/action@615a78f6c83e116339c53b94f3f82b4d6c0b7d18 # v5.0.0
- id: package
run: |
echo "PACKAGE_NAME=$(jq --raw-output '.name' package.json)" >> "${GITHUB_OUTPUT}"
- run: |
npx --yes "https://pkg.pr.new/${PACKAGE_NAME}@${BASE_REF}" --help
env:
PACKAGE_NAME: ${{ steps.package.outputs.PACKAGE_NAME }}
BASE_REF: ${{ github.event.pull_request.base.ref }}
- uses: thollander/actions-comment-pull-request@24bffb9b452ba05a4f3f77933840a6a841d1b32b # v3.0.1
with:
message: |
## :test_tube: Package testing instructions
This pull request has been merged, its base branch can be tested locally with the following command:
```shell
npx --yes "https://pkg.pr.new/${{ steps.package.outputs.PACKAGE_NAME }}@${{ github.event.pull_request.base.ref }}" [commands..] [options]
```
_Comment generated by the [${{ github.workflow }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}) workflow._
comment-tag: npm-exec
mode: recreate