Skip to content

Upgrade puppeteer

Upgrade puppeteer #500

# https://github.com/macbre/phantomas/pull/1066 followed by https://github.com/macbre/phantomas/pull/1095 confused dependabot
#
# It still complains:
#
# updater | INFO <job_408133868> Starting job processing
# updater | INFO <job_408133868> Starting update job for macbre/phantomas
# updater | INFO <job_408133868> Checking if puppeteer 15.1.1 needs updating
# updater | INFO <job_408133868> Ignored versions:
# updater | INFO <job_408133868> < 13.1, > 13.0.1 - from @dependabot ignore command
# updater | INFO <job_408133868> > 13.0.1 - from @dependabot ignore command
# proxy | 2022/06/29 15:47:48 [016] GET https://registry.npmjs.org:443/puppeteer
# proxy | 2022/06/29 15:47:51 [016] 200 https://registry.npmjs.org:443/puppeteer
# updater | INFO <job_408133868> All updates for puppeteer were ignored
name: Upgrade puppeteer
# Controls when the action will run.
on:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: '0 5 * * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
update:
runs-on: ubuntu-latest
env:
GIT_BRANCH: "devel"
GIT_USER_NAME: "macbre"
GIT_USER_EMAIL: "<[email protected]>"
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# https://github.com/actions/checkout
- name: Cloning ${{ env.GIT_BRANCH }} branch
uses: actions/checkout@v4
with:
ref: ${{ env.GIT_BRANCH }}
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: latest
- name: Install dependencies and try to bump puppeteer
run: |
set -x
npm ci
npm i --save --verbose puppeteer@latest
# https://github.com/actions/checkout#push-a-commit-using-the-built-in-token
- name: Set up git
run: |
git config user.name ${GIT_USER_NAME}
git config user.email ${GIT_USER_EMAIL}
- name: Show a diff
run: git diff
- name: Commit if needed to a new branch (and create a PR)
continue-on-error: true
env:
# use Personal Access Token so that the PR is opened by the real user and CI jobs are run
# https://github.com/settings/tokens - with "repo" scope and "read:org"
GH_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
set -x
gh auth status
export VERSION="$(npm list --json | jq -r .dependencies.puppeteer.version)"
export PR_BRANCH="puppeteer/${VERSION}"
git checkout -b ${PR_BRANCH}
git add package* && git checkout -- .
git commit -m "(deps) bump puppeteer to v${VERSION}" \
&& git push origin ${PR_BRANCH} --force \
&& gh pr create \
--assignee macbre \
--label 'external dependency' \
--base ${{ env.GIT_BRANCH }} \
--title "bump puppeteer to v${VERSION}" \
--body "[Release notes](https://github.com/puppeteer/puppeteer/releases/tag/puppeteer-v${VERSION})"
# e.g. https://github.com/macbre/analyze-css/pull/443
export PR_URL=$(gh pr view ${PR_BRANCH} --json url | jq -r .url)
echo "::notice::Pull request created: <${PR_URL}>"
# now mark the PR as auto-merged
# automated patch release will happen on merges to master
gh pr merge --auto --merge "$PR_URL"