chore: fix issues with auto analyze workflow (#1031)
This commit is contained in:
40
.github/workflows/auto-analyze.yml
vendored
40
.github/workflows/auto-analyze.yml
vendored
@@ -1,4 +1,4 @@
|
|||||||
name: 'Auto add analyze label if package.json was edited'
|
name: 'Auto analyze if package.json was edited'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -9,34 +9,30 @@ permissions:
|
|||||||
pull-requests: write
|
pull-requests: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
add-analyze-label:
|
auto-analyze:
|
||||||
name: 'Add analyze label'
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
|
ref: ${{ github.event.pull_request.head.sha }}
|
||||||
|
|
||||||
- name: Get changed files
|
- name: Check package.json was changed
|
||||||
id: changed-files
|
|
||||||
uses: tj-actions/changed-files@v24.1
|
|
||||||
|
|
||||||
- name: Get package.json is changed file
|
|
||||||
id: changed-file-package-json
|
id: changed-file-package-json
|
||||||
uses: tj-actions/changed-files@v24.1
|
uses: tj-actions/changed-files@v23
|
||||||
with:
|
with:
|
||||||
files: |
|
sha: ${{ github.event.pull_request.head.sha }}
|
||||||
package.json
|
|
||||||
|
|
||||||
- name: Add Label
|
- name: Install node
|
||||||
if: steps.changed-file-package-json.outputs.any_changed == 'true'
|
uses: actions/setup-node@v3
|
||||||
uses: actions/github-script@v6
|
if: contains(steps.changed-file-package-json.outputs.modified_files, 'package.json')
|
||||||
with:
|
with:
|
||||||
github-token: ${{secrets.GITHUB_TOKEN}}
|
node-version: '16'
|
||||||
script: |
|
cache: 'npm'
|
||||||
github.rest.issues.addLabels({
|
|
||||||
issue_number: context.issue.number,
|
- uses: preactjs/compressed-size-action@v2
|
||||||
owner: context.repo.owner,
|
if: contains(steps.changed-file-package-json.outputs.modified_files, 'package.json')
|
||||||
repo: context.repo.repo,
|
with:
|
||||||
labels: ['analyze']
|
strip-hash: "\\b\\w{8}\\."
|
||||||
})
|
pattern: './dist/**/*.{js,css,html,json,woff2,svg,png}'
|
||||||
|
exclude: '{./dist/manifest.json,./dist/build.zip,**/*.map,**/node_modules/**}'
|
||||||
|
Reference in New Issue
Block a user