78 lines
3.3 KiB
YAML
78 lines
3.3 KiB
YAML
name: Comment on Issue
|
|
|
|
on:
|
|
issues:
|
|
types: [opened, edited, reopened]
|
|
workflow_dispatch:
|
|
inputs:
|
|
issue_number:
|
|
description: 'Issue number to run the check issue job against'
|
|
required: true
|
|
type: number
|
|
|
|
jobs:
|
|
checkIssue:
|
|
name: Check issue
|
|
runs-on: ubuntu-slim
|
|
timeout-minutes: 5
|
|
permissions:
|
|
issues: write
|
|
if: |
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(github.event_name == 'issues' &&
|
|
contains(fromJSON('["opened", "edited"]'), github.event.action) &&
|
|
github.event.sender.login != 'issuehunt-oss[bot]' &&
|
|
!contains(fromJSON('["OWNER", "MEMBER", "COLLABORATOR"]'), github.event.issue.author_association))
|
|
outputs:
|
|
closed: ${{ steps.check.outputs.closed }}
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: lts/*
|
|
cache: 'pnpm'
|
|
- name: Install dependencies (pnpm) # import remark-parse and unified
|
|
run: pnpm i
|
|
- name: Check issue format
|
|
id: check
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
env:
|
|
ISSUE_NUMBER: ${{ inputs.issue_number }}
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const { default: invalidIssue } = await import('${{ github.workspace }}/scripts/workflow/test-issue/check-issue.mjs')
|
|
const invalid = await invalidIssue({ github, context, core })
|
|
core.setOutput('closed', invalid ? 'true' : 'false')
|
|
|
|
callMaintainers:
|
|
name: Call maintainers
|
|
needs: [checkIssue]
|
|
runs-on: ubuntu-slim
|
|
timeout-minutes: 5
|
|
permissions:
|
|
issues: write
|
|
if: |
|
|
!cancelled() &&
|
|
github.event_name == 'issues' &&
|
|
github.event.sender.login != 'issuehunt-oss[bot]' &&
|
|
(needs.checkIssue.result == 'success' || needs.checkIssue.result == 'skipped') &&
|
|
needs.checkIssue.outputs.closed != 'true'
|
|
steps:
|
|
- uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
|
|
- uses: pnpm/action-setup@0e279bb959325dab635dd2c09392533439d90093 # v6.0.8
|
|
- uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0
|
|
with:
|
|
node-version: lts/*
|
|
cache: 'pnpm'
|
|
- name: Install dependencies (pnpm) # import remark-parse and unified
|
|
run: pnpm i
|
|
- name: Generate feedback
|
|
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
with:
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
|
script: |
|
|
const { default: callMaintainer } = await import('${{ github.workspace }}/scripts/workflow/test-issue/call-maintainer.mjs')
|
|
await callMaintainer({ github, context, core })
|