Skip to content

Bump web-vitals from 3.5.2 to 4.0.0 in /src #455

Bump web-vitals from 3.5.2 to 4.0.0 in /src

Bump web-vitals from 3.5.2 to 4.0.0 in /src #455

######################################
## Custom Web Almanac GitHub action ##
######################################
#
# This Action generates the dynamic templates. It also then takes a copy
# of the templates folder, and then checks out main branch and regenerates the
# templates and compares the two. If run from a pull request it adds a comment
# showing the diffs.
#
# Note it does not run a full test of the website as that will be completed by
# the test_website.yml GitHub Action.
#
# This Action is useful to check impact of dependency upgrades (e.g. if
# prettier version change results in different HTML being generated), since we
# do not store generated templates in Git and so cannot otherwise see these
# changes. Changes can then be accepted or investigated further before merging.
#
name: Test Template Changes
on:
workflow_dispatch:
pull_request:
paths:
- '**/package.json'
- '**/package-lock.json'
jobs:
build:
name: Build and Test Template Changes
runs-on: ubuntu-20.04
if: github.repository == 'HTTPArchive/almanac.httparchive.org'
steps:
- name: Checkout Code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Node.js for use with actions
uses: actions/setup-node@v4
with:
node-version: '16'
- name: Test Template Changes
run: ./src/tools/scripts/test_template_changes.sh
- name: 'Comment PR'
uses: actions/github-script@v7
if: github.event_name == 'pull_request' && env.PR_COMMENT != ''
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
# yamllint disable rule:line-length
script: |
const { issue: { number: issue_number }, repo: { owner, repo } } = context;
// Unescape any escaped comments so code blocks appear correctly
const pr_comment = process.env.PR_COMMENT.replace(/%0A/g,'\n').replace(/%0D/g,'\r').replace(/%27/g,"'").replace(/%22/g,'"').replace(/%25/g,'%');
github.rest.issues.createComment({ issue_number, owner, repo, body: pr_comment });