Skip to content

Commit

Permalink
add a "cleanup-checks" trigger action
Browse files Browse the repository at this point in the history
  • Loading branch information
phryneas committed Nov 9, 2023
1 parent 291aea5 commit b16d66d
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 5 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/cleanup-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Clean up Prettier, Size-limit, and Api-Extractor

on:
workflow_dispatch:
inputs:
prNumber:
description: "target PR"
required: true
type: number

jobs:
cleanup:
name: release:next
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
ref: refs/pull/${{ inputs.prNumber }}/merge

- name: Setup Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 18.x

- name: Install dependencies (with cache)
uses: bahmutov/npm-install@v1

- name: Run build
run: npm run build

- name: Run Api-Extractor
run: npm run extract-api
env:
CI: false

- name: Run prettier
run: npm run format

- name: Update size-limit
run: npm run update-size-limits

# commit & push
# if there is a "trigger this action" comment in the PR, remove it

# - name: Create comment
# if: ${{ steps.added-files.outputs.changesets != '' }}
# uses: peter-evans/[email protected]
# with:
# issue-number: ${{ github.event.issue.number }}
# body: |
# A new release has been made for this PR. You can install it with `npm i @apollo/client@${{ steps.get-version.outputs.version }}`.
12 changes: 8 additions & 4 deletions .size-limit.cjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
const limits = require("./.size-limits.json");

const checks = [
{
path: "dist/apollo-client.min.cjs",
limit: "37956",
},
{
path: "dist/main.cjs",
Expand All @@ -10,7 +11,6 @@ const checks = [
{
path: "dist/index.js",
import: "{ ApolloClient, InMemoryCache, HttpLink }",
limit: "32017",
},
...[
"ApolloProvider",
Expand Down Expand Up @@ -53,7 +53,7 @@ const checks = [
value.path == "dist/apollo-client.min.cjs"
? value
: [
{ ...value, limit: undefined },
value,
{
...value,
name: `${value.name} (production)`,
Expand All @@ -65,6 +65,10 @@ const checks = [
},
},
]
);
)
.map((value) => {
value.limit = limits[value.name];
return value;
});

module.exports = checks;
4 changes: 4 additions & 0 deletions .size-limits.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"dist/apollo-client.min.cjs": 37972,
"import { ApolloClient, InMemoryCache, HttpLink } from \"dist/index.js\" (production)": 32017
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@
"typedoc": "typedoc src/index.ts --json docs/public/docs.json",
"changeset-publish": "npm run build && npm run prepdist:changesets && cd dist && changeset publish",
"changeset-check": "changeset status --verbose --since=origin/main",
"changeset-version": "changeset version && npm i"
"changeset-version": "changeset version && npm i",
"update-size-limits": "size-limit --json | jq '. | map(select(.sizeLimit) | { key: .name, value: .size}) | from_entries' | tee .new-size-limits.json; mv .new-size-limits.json .size-limits.json"
},
"engines": {
"npm": "^7.20.3 || ^8.0.0 || ^9.0.0 || ^10.0.0"
Expand Down

0 comments on commit b16d66d

Please sign in to comment.