moved setting of copilot token to installation step #19
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: label-issues | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - relabeling | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| jobs: | |
| label-issues: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set-up labels and label filter | |
| id: set-up | |
| run: | | |
| LABELS=$(jq -r '.labels' ./labels.json) | |
| echo "labels<<EOF" >> $GITHUB_ENV | |
| echo "$LABELS" >> $GITHUB_ENV | |
| echo "EOF" >> $GITHUB_ENV | |
| echo "filter=$(jq -r '.filter' ./labels.json)" >> $GITHUB_ENV | |
| - name: Collect all issues | |
| run: | | |
| gh issue list --state all --label "plugin-modification" --json number,labels,body > issues.json | |
| - name: Find unlabeled issues | |
| run: | | |
| echo "$labels" | |
| echo "$filter" | |
| jq --argjson labels "$labels" "$filter" issues.json > unlabeled_issues.json | |
| - name: Install Copilot CLI | |
| run: | | |
| curl -fsSL https://gh.io/copilot-install | bash | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| env: | |
| COPILOT_GITHUB_TOKEN: ${{ secrets.COPILOT_GITHUB_TOKEN }} | |
| - name: Generate labels for issue | |
| run: | | |
| jq -r -c '.[] | "\(.number) \(.body)"' ./unlabeled_issues.json | while read -r number && read -r body; do | |
| echo "Generating labels for: Issue No. $number" | |
| LABELS=$(copilot --prompt "Pick labels from $labels for issue $number based on the content of $body" \ | |
| --model gpt-4.1 \ | |
| --allow-tool "read_file") | |
| echo "Labels generated: $LABELS" | |
| done |