|
1 | 1 | on: |
2 | | - workflow_call: |
3 | | - schedule: |
4 | | - - cron: '0 * * * *' # Runs every hour |
5 | 2 | issues: |
6 | | - types: [opened, edited, reopened] |
| 3 | + types: [opened] |
7 | 4 | pull_request: |
| 5 | + types: [opened] |
8 | 6 | branches: |
9 | 7 | - 'main' |
10 | | - workflow_dispatch: |
11 | 8 |
|
12 | 9 | jobs: |
13 | 10 | triage: |
14 | 11 | runs-on: ubuntu-latest |
15 | 12 | timeout-minutes: 7 |
16 | | - outputs: |
17 | | - available_labels: '${{ steps.get_labels.outputs.available_labels }}' |
18 | | - selected_labels: '${{ env.SELECTED_LABELS }}' |
19 | 13 | permissions: |
20 | 14 | contents: 'read' |
21 | 15 | id-token: 'write' |
22 | 16 | issues: 'read' |
23 | 17 | pull-requests: 'read' |
24 | 18 | steps: |
25 | | - - name: 'Get repository labels' |
26 | | - id: get_labels |
27 | | - uses: 'actions/github-script@main' |
28 | | - with: |
29 | | - script: |- |
30 | | - const { data: labels } = await github.rest.issues.listLabelsForRepo({ |
31 | | - owner: context.repo.owner, |
32 | | - repo: context.repo.repo, |
33 | | - }); |
34 | | -
|
35 | | - if (!labels || labels.length === 0) { |
36 | | - core.setFailed('There are no issue labels in this repository.') |
37 | | - } |
38 | | -
|
39 | | - const labelNames = labels.map(label => label.name).sort(); |
40 | | - core.setOutput('available_labels', labelNames.join(',')); |
41 | | - core.info(`Found ${labelNames.length} labels: ${labelNames.join(', ')}`); |
42 | | - return labelNames; |
43 | 19 | - uses: austenstone/copilot-cli@main |
44 | | - if: steps.get_labels.outputs.available_labels != '' |
45 | 20 | env: |
46 | | - GITHUB_TOKEN: '' # Do NOT pass any auth tokens here since this runs on untrusted inputs |
47 | 21 | ISSUE_TITLE: '${{ github.event.issue.title }}' |
48 | 22 | ISSUE_BODY: '${{ github.event.issue.body }}' |
49 | | - AVAILABLE_LABELS: '${{ steps.get_labels.outputs.available_labels }}' |
50 | 23 | with: |
51 | 24 | copilot-token: ${{ secrets.PAT }} |
52 | 25 | prompt: | |
|
61 | 34 |
|
62 | 35 | ## Input Data |
63 | 36 |
|
64 | | - **Available Labels** (comma-separated): |
65 | | - ``` |
66 | | - ${{ env.AVAILABLE_LABELS }} |
67 | | - ``` |
68 | | -
|
69 | 37 | **Issue Title**: |
70 | 38 | ``` |
71 | 39 | ${{ env.ISSUE_TITLE }} |
|
83 | 51 |
|
84 | 52 | ## Steps |
85 | 53 |
|
| 54 | + 0. Fetch possible labels from the repository. |
| 55 | +
|
86 | 56 | 1. Review the issue title, issue body, and available labels provided above. |
87 | 57 |
|
88 | 58 | 2. Based on the issue title and issue body, classify the issue and choose all appropriate labels from the list of available labels. |
|
0 commit comments