Use trusted publishing and provenance for NPM #53
Workflow file for this run
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: Test compatibility with puppeteer | |
| on: | |
| pull_request: ~ | |
| workflow_dispatch: ~ | |
| jobs: | |
| test-compatibility: | |
| if: github.event_name == 'workflow_dispatch' || (github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository) | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| # Run tests on master and latest released version of website-scraper-puppeteer module | |
| website-scraper-puppeteer-version: [master, latest-release] | |
| steps: | |
| - | |
| name: Get latest release tag of website-scraper/website-scraper-puppeteer | |
| if: matrix.website-scraper-puppeteer-version == 'latest-release' | |
| id: get_latest_release | |
| uses: actions/github-script@v8 | |
| with: | |
| result-encoding: string | |
| script: | | |
| const latestRelease = await github.rest.repos.getLatestRelease({ | |
| owner: 'website-scraper', | |
| repo: 'website-scraper-puppeteer' | |
| }); | |
| return latestRelease.data.tag_name; | |
| - name: Checkout website-scraper-puppeteer | |
| uses: actions/checkout@v5 | |
| with: | |
| repository: website-scraper/website-scraper-puppeteer | |
| ref: ${{ steps.get_latest_release.outputs.result || matrix.website-scraper-puppeteer-version }} | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: '22' | |
| - name: Install dependencies | |
| run: npm install | |
| - name: Install version wrapper package from the branch | |
| run: npm install website-scraper/puppeteer-version-wrapper#${{ github.head_ref }} --save | |
| - name: Disable AppArmor | |
| run: echo 0 | sudo tee /proc/sys/kernel/apparmor_restrict_unprivileged_userns | |
| - name: Run tests | |
| run: npm test |