Skip to content

Version v11.12.4 #29027

Version v11.12.4

Version v11.12.4 #29027

name: Fitness Functions CI
on:
pull_request:
types: [assigned, opened, synchronize, reopened]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
cache: yarn
- name: Install dependencies
run: yarn --immutable
- name: Run fitness functions
env:
BASE_REF: ${{ github.event.pull_request.base.ref }}
run: |
# The following command generates a diff of changes between the common
# ancestor of $BASE_REF and HEAD, and the current commit (HEAD), for
# files in the current directory and its subdirectories. The output is
# then saved to a file called "diff".
git diff "$(git merge-base "origin/$BASE_REF" HEAD)" HEAD -- . > ./diff
npm run fitness-functions -- "ci" "./diff"
update-codespaces-badge:
runs-on: ubuntu-latest
permissions:
pull-requests: write
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
# This use of an ENV variable is neccessary to avoid an injection attack, see:
# https://docs.github.com/en/actions/security-guides/security-hardening-for-github-actions
BODY: ${{ github.event.pull_request.body }}
steps:
- name: Replace the text in the Codespaces badge with the PR number
run: |
#!/bin/bash
# Bash replace syntax
NEW_BODY="${BODY/PR?quickstart=1/$PR_NUMBER?quickstart=1}"
# If the body has changed as a result of the replace, use the GitHub API to update the PR
if [ "$NEW_BODY" != "$BODY" ]; then
gh api /repos/MetaMask/metamask-extension/pulls/${{github.event.pull_request.number}} -f body="$NEW_BODY"
fi