Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add clean-script option #60

Merged
merged 3 commits into from
Jun 21, 2021
Merged

Add clean-script option #60

merged 3 commits into from
Jun 21, 2021

Conversation

developit
Copy link
Member

@developit developit commented Jun 21, 2021

This addresses the case outlined in #59.

/cc @scinos


preview of added doc section:

Clean up state between builds

For repositories or custom monorepo setups where files are modified in ways that are not reset by npm ci && npm run build, it may be necessary to define a custom "clean" script. This script resets any file modifications after the upstream (target) build ends and your PR code (HEAD) is checked out, but before installation of npm dependencies for HEAD:

name: Compressed Size
on: [pull_request]
jobs:
  build:
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v2
    - uses: preactjs/compressed-size-action@v2
      with:
        repo-token: "${{ secrets.GITHUB_TOKEN }}"
+       clean-script: "clean"
// package.json
{
  "scripts": {
    // example - a simple nested node_modules setup:
    "postinstall": "cd packages && npm i",
    // between the two builds, we need to delete the inner node_modules:
    "clean": "rm -rf packages/node_modules"
  }
}

@github-actions
Copy link

github-actions bot commented Jun 21, 2021

Size Change: 0 B

Total Size: 75.5 kB

ℹ️ View Unchanged
Filename Size
index.js 75.5 kB

compressed-size-action

@developit developit merged commit c410a2d into master Jun 21, 2021
@developit developit deleted the add-clean-script branch June 21, 2021 17:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants