Skip to content

Create Github Workflow to Auto-Followup on Issue Creation #11600

@mekarpeles

Description

@mekarpeles

Feature Request

Right now our Issue template tries to predict many different use cases and to be overly-comprehensive.

This issue calls for leveraging our github open source credits to create a workflow that runs when an issue is created (by staff + leads) to provide context and focused next steps based on the original issue.

Possible workflow

name: Issue PM AI

on:
  issues:
    types: [opened]

permissions:
  contents: read
  issues: write
  models: read

jobs:
  respond:
    runs-on: ubuntu-latest

    steps:
      - uses: actions/checkout@v4
      - name: Load PM AI Instructions
        id: pm
        run: |
          echo "INSTRUCTIONS<<EOF" >> $GITHUB_OUTPUT
          cat .github/prompts/issue_pm_instructions.md >> $GITHUB_OUTPUT
          echo "EOF" >> $GITHUB_OUTPUT

      - name: Generate issue response (GitHub Models)
        id: generate
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          ISSUE_TITLE: ${{ github.event.issue.title }}
          ISSUE_BODY: ${{ github.event.issue.body }}
          INSTRUCTIONS: ${{ steps.pm.outputs.INSTRUCTIONS }}
        run: |
          CONTENT=$(curl -s https://models.github.ai/inference/chat/completions \
            -H "Authorization: Bearer $GITHUB_TOKEN" \
            -H "Content-Type: application/json" \
            -d "{
              \"model\": \"gpt-4.1-mini\",
              \"messages\": [
                {\"role\": \"system\", \"content\": \"$INSTRUCTIONS\"},
                {\"role\": \"user\", \"content\": \"Issue title: $ISSUE_TITLE\n\nIssue body:\n$ISSUE_BODY\"}
              ]
            }" | jq -r '.choices[0].message.content')

          # Expose as step output
          echo "CONTENT<<EOF" >> $GITHUB_OUTPUT
          echo "$CONTENT" >> $GITHUB_OUTPUT
          echo "EOF" >> $GITHUB_OUTPUT

      - name: Post response to issue
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          REPO: ${{ github.repository }}
          ISSUE_NUMBER: ${{ github.event.issue.number }}
          BODY: ${{ steps.generate.outputs.CONTENT }}
        run: |
          curl -s -X POST \
            -H "Authorization: Bearer $GITHUB_TOKEN" \
            -H "Accept: application/vnd.github+json" \
            https://api.github.com/repos/$REPO/issues/$ISSUE_NUMBER/comments \
            -d "$(jq -n --arg body "$BODY" '{body: $body}')"

Instructions

This PR requires the creation of a new file issue_pmai_instructions.md probably in the .github directory, maybe under a directory called prompts, that requests the following:

  1. Relevant Files -- only if there's enough context to unambiguously suggest relevant files, show the files and snippets that are relevant
  2. Relevant Documentation -- only if there's enough context (the mapping of of docs to topics should be specified in the template) then refer contributor to relevant docs.
  3. Reference PRs -- if there's been a related pull request, reference + link it
  4. Similar Issues -- If there are related or duplicate Issues, try to reference them by #number for context
  5. Labels -- If the issue touches a file that can only be tested by staff (e.g. authentication, borrowing, account deactivation, affiliate server) then tag as Needs: Staff. If an issue is clearly a good first issue, mark it as such but do so judiciously.
  6. Next Steps -- relevant instructions and steps before assignment. e.g. remove the "rebase" tips and only include this in the response if it's relevant to the issue. State it's not ready yet if it doesn't have a priority and lead label. If no approach is specified, ask the contributor to clarify the approach or ask questions before requesting assignment.

Metadata

Metadata

Labels

Lead: @mekarpelesIssues overseen by Mek (Staff: Program Lead) [managed]Priority: 2Important, as time permits. [managed]Theme: Project ManagementType: Feature RequestIssue describes a feature or enhancement we'd like to implement. [managed]

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions