puppeteer/.github/workflows/issue-analyzer.yml
dependabot[bot] 7a40845581
chore(deps): Bump the all group with 5 updates (#12299)
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-04-22 09:30:26 +02:00

245 lines
9.6 KiB
YAML

name: Issue Analyzer
permissions: read-all
on:
issues:
types: [opened, reopened, edited]
concurrency:
group: issue-${{ format('issue-{0}', github.event.issue.number) }}
cancel-in-progress: true
jobs:
analyze-issue:
name: Analyze Issues
runs-on: ubuntu-latest
if: ${{ contains(github.event.issue.labels.*.name, 'bug') && !contains(github.event.issue.labels.*.name, 'disable-analyzer') && !contains(github.event.issue.labels.*.name, 'confirmed') && !contains(github.event.issue.labels.*.name, '@puppeteer/browsers') && !contains(github.event.issue.labels.*.name, '@puppeteer/ng-schematics') && github.event.issue.number > 9481 }}
env:
ISSUE_BODY: ${{ toJson(github.event.issue.body) }}
outputs:
runsOn: ${{ steps.issue-analysis.outputs.runsOn }}
nodeVersion: ${{ steps.issue-analysis.outputs.nodeVersion }}
packageManager: ${{ steps.issue-analysis.outputs.packageManager }}
errorMessage: ${{ steps.issue-analysis.outputs.errorMessage }}
permissions:
issues: write
steps:
- name: Remove labels
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
if (${{ contains(github.event.issue.labels.*.name, 'not-reproducible') }}) {
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ["not-reproducible"]
})
}
if (${{ contains(github.event.issue.labels.*.name, 'needs-feedback') }}) {
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ["needs-feedback"]
})
}
if (${{ contains(github.event.issue.labels.*.name, 'invalid') }}) {
github.rest.issues.removeLabel({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
name: ["invalid"]
})
}
- name: Check out repository
uses: actions/checkout@1d96c772d19495a3b5c517cd2bc0cb401ea0529f # v4.1.3
- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version-file: '.nvmrc'
- name: Install dependencies
run: npm ci
- name: Analyze issue
id: issue-analysis
run: echo $ISSUE_BODY | ./tools/analyze_issue.mjs >> $GITHUB_OUTPUT
- uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
with:
name: issue-files
path: out/
verify-issue:
name: Verify Issue
needs: analyze-issue
runs-on: ${{ needs.analyze-issue.outputs.runsOn }}
permissions:
issues: write
env:
PACKAGE_MANAGER: ${{ needs.analyze-issue.outputs.packageManager }}
NODE_VERSION: ${{ needs.analyze-issue.outputs.nodeVersion }}
steps:
- uses: actions/download-artifact@8caf195ad4b1dee92908e23f56eeb0696f1dd42d # v4.1.5
with:
name: issue-files
path: '.'
- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: ${{ env.NODE_VERSION }}
- name: Enable corepack
run: corepack enable
- name: Install dependencies
run: ${{ env.PACKAGE_MANAGER }} install
env:
YARN_ENABLE_IMMUTABLE_INSTALLS: false
- name: Install dependencies Firefox
run: node ./node_modules/puppeteer/install.mjs
env:
PUPPETEER_PRODUCT: firefox
- name: Verify issue
timeout-minutes: 10
run: ${{ env.PACKAGE_MANAGER }} run verify
env:
DEBUG: 'puppeteer:*'
- uses: actions/upload-artifact@1746f4ab65b179e0ea60a494b83293b640dd5bba # v4.3.2
if: success() || failure()
with:
name: runtime-output
path: |
*.log
**/*.pdf
if-no-files-found: error
label-verified-issue:
needs: [verify-issue]
if: success()
name: Label verified issue
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Add labels
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["confirmed"]
})
- name: Find Comment Id
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: find-comment-id
with:
issue-number: ${{ github.event.issue.number }}
comment-author: 'github-actions[bot]'
- name: Upsert comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.find-comment-id.outputs.comment-id }}
issue-number: ${{ github.event.issue.number }}
edit-mode: replace
body: |
The issue has been labeled as **confirmed** by the automatic analyser.
Someone from the Puppeteer team will take a look soon!
---
[Analyzer run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
label-invalid-issue:
needs: [analyze-issue]
if: failure() && needs.analyze-issue.outputs.errorMessage != ''
name: Label invalid issue
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Add labels
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["invalid"]
})
- name: Find Comment Id
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: find-comment-id
with:
issue-number: ${{ github.event.issue.number }}
comment-author: 'github-actions[bot]'
- name: Upsert comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.find-comment-id.outputs.comment-id }}
issue-number: ${{ github.event.issue.number }}
edit-mode: replace
body: |
${{ needs.analyze-issue.outputs.errorMessage }}
---
[Analyzer run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
label-unverifiable-issue:
needs: [analyze-issue, verify-issue]
if: failure() && needs.analyze-issue.outputs.errorMessage == ''
name: Label unverifiable issue
runs-on: ubuntu-latest
permissions:
issues: write
steps:
- name: Add labels
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ["not-reproducible", "needs-feedback"]
})
- name: Find Comment Id
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: find-comment-id
with:
issue-number: ${{ github.event.issue.number }}
comment-author: 'github-actions[bot]'
- name: Upsert comment
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
comment-id: ${{ steps.find-comment-id.outputs.comment-id }}
issue-number: ${{ github.event.issue.number }}
edit-mode: replace
body: |
This issue was not reproducible. Please check that your example runs locally and the following:
- Ensure the script does not rely on dependencies outside of `puppeteer` and `puppeteer-core`.
- Ensure the error string is just the error message.
- Bad:
```ts
Error: something went wrong
at Object.<anonymous> (/Users/username/repository/script.js:2:1)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
```
- Good: `Error: something went wrong`.
- Ensure your configuration file (if applicable) is valid.
- If the issue is flaky (does not reproduce all the time), make sure 'Flaky' is checked.
- If the issue is not expected to error, make sure to write 'no error'.
Once the above checks are satisfied, please edit your issue with the changes and we will
try to reproduce the bug again.
---
[Analyzer run](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})