Skip to content

chore(jsapi-node): update README #225

chore(jsapi-node): update README

chore(jsapi-node): update README #225

Workflow file for this run

name: ESM Sample Metrics
on:
pull_request:
types: [opened, reopened, synchronize, labeled, unlabeled]
branches: [main]
jobs:
analyze:
if: "!contains(github.event.pull_request.labels.*.name, 'draft') && github.actor!='dependabot-preview[bot]'"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
token: ${{ secrets.ESM_BUILD }}
- name: should samples build
id: build
run: |
current_branch=$(git rev-parse --abbrev-ref HEAD)
# package.json files changed in the branch
packages_changed=$(git diff --name-only "$current_branch" $(git merge-base "$current_branch" origin/main) -- "./esm-samples/**/package.json")
# metric files changed in the previous commit
metrics_changed=$(git diff --name-only HEAD^ HEAD -- "./esm-samples/.metrics/*.csv")
if [ -z "$packages_changed" ]; then
echo "no package.json files changed, skipping build analysis"
elif [ -n "$metrics_changed" ]; then
echo "metric files changed: $metrics_changed"
echo "the previous commit contained build metrics, skipping build analysis"
else
echo "package.json files changed: $packages_changed"
echo "analyzing builds"
echo "skip=false" >> $GITHUB_OUTPUT
fi
- if: steps.build.outputs.skip == 'false'
name: setup node
uses: actions/setup-node@v3
with:
node-version: 16
- if: steps.build.outputs.skip == 'false'
name: install dependencies for sample metrics script
run: |
cd ./.github/scripts/
npm i
- if: steps.build.outputs.skip == 'false'
name: run sample metrics script
run: node ./.github/scripts/analyze-builds.js
- name: push sample metrics analysis
if: steps.build.outputs.skip == 'false'
run: |
git branch
git status
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add ./esm-samples/.metrics/*.csv
git status
git commit -m "ci: analyze esm sample builds" || true
git push origin ${{ github.event.pull_request.head.ref }}
git status