diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index 50225b9103b..1cf038760e8 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -700,7 +700,6 @@ embed.go @grafana/grafana-as-code /.github/workflows/commands.yml @torkelo /.github/workflows/community-release.yml @grafana/grafana-release-guild /.github/workflows/detect-breaking-changes-* @grafana/plugins-platform-frontend -/.github/workflows/auto-triager.yml @grafana/plugins-platform-frontend /.github/workflows/doc-validator.yml @grafana/docs-tooling /.github/workflows/epic-add-to-platform-ux-parent-project.yml @meanmina /.github/workflows/github-release.yml @grafana/grafana-release-guild diff --git a/.github/workflows/auto-triager.yml b/.github/workflows/auto-triager.yml deleted file mode 100644 index 80eeba554cb..00000000000 --- a/.github/workflows/auto-triager.yml +++ /dev/null @@ -1,75 +0,0 @@ -# This workflow is triggered when a new issue is opened -# It will run an internal github action to try to automate the triage process -name: Auto Triage Issues -on: - issues: - types: [opened] - -jobs: - config: - runs-on: "ubuntu-latest" - outputs: - has-secrets: ${{ steps.check.outputs.has-secrets }} - steps: - - name: "Check for secrets" - id: check - shell: bash - run: | - if [ -n "${{ (secrets.GRAFANA_DELIVERY_BOT_APP_ID != '' && - secrets.GRAFANA_DELIVERY_BOT_APP_PEM != '' && - secrets.OPENAI_API_KEY != '' && - secrets.SLACK_WEBHOOK_URL != '' - ) || '' }}" ]; then - echo "has-secrets=1" >> "$GITHUB_OUTPUT" - fi - auto-triage: - needs: config - if: needs.config.outputs.has-secrets - runs-on: ubuntu-latest - steps: - - name: "Generate token" - id: generate_token - uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 - with: - app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }} - private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }} - - - name: Checkout auto-triager repository - uses: actions/checkout@v4 - with: - repository: grafana/auto-triager - path: auto-triager - token: ${{ steps.generate_token.outputs.token }} - - - name: Send issue to the auto triager action - id: auto_triage - # https://github.com/grafana/auto-triager/blob/main/action.yml - #uses: grafana/auto-triager@main - uses: ./auto-triager - with: - token: ${{ secrets.GITHUB_TOKEN }} - issue_number: ${{ github.event.issue.number }} - openai_api_key: ${{ secrets.OPENAI_API_KEY }} - # Leaving the actionin monitoring mode for now - # should be set to true when ready to use - # add_labels: true - add_labels: false - - - name: Labels from auto triage - run: | - echo ${{ steps.auto_triage.outputs.triage_labels }} - - - name: "Send Slack notification" - if : ${{ steps.auto_triage.outputs.triage_labels != '' }} - uses: slackapi/slack-github-action@v1.27.0 - with: - payload: > - { - "icon_emoji": ":robocto:", - "username": "Auto Triager", - "type": "mrkdwn", - "text": "Auto triager found the following labels: ${{ steps.auto_triage.outputs.triage_labels }} for [issue #${{ github.event.issue.number }}](${{ github.event.issue.html_url }})", - "channel": "#triage-automation-ci" - } - env: - SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} diff --git a/.github/workflows/issue-opened.yml b/.github/workflows/issue-opened.yml index 5df1de30a2c..d07c5ad416c 100644 --- a/.github/workflows/issue-opened.yml +++ b/.github/workflows/issue-opened.yml @@ -26,3 +26,70 @@ jobs: metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}} token: ${{secrets.ISSUE_COMMANDS_TOKEN}} configPath: "issue-opened" + config: + runs-on: "ubuntu-latest" + outputs: + has-secrets: ${{ steps.check.outputs.has-secrets }} + steps: + - name: "Check for secrets" + id: check + shell: bash + run: | + if [ -n "${{ (secrets.GRAFANA_DELIVERY_BOT_APP_ID != '' && + secrets.GRAFANA_DELIVERY_BOT_APP_PEM != '' && + secrets.OPENAI_API_KEY != '' && + secrets.SLACK_WEBHOOK_URL != '' + ) || '' }}" ]; then + echo "has-secrets=1" >> "$GITHUB_OUTPUT" + fi + auto-triage: + needs: [main, config] + if: needs.config.outputs.has-secrets + runs-on: ubuntu-latest + steps: + - name: "Generate token" + id: generate_token + uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 + with: + app_id: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_ID }} + private_key: ${{ secrets.GRAFANA_DELIVERY_BOT_APP_PEM }} + + - name: Checkout auto-triager repository + uses: actions/checkout@v4 + with: + repository: grafana/auto-triager + path: auto-triager + token: ${{ steps.generate_token.outputs.token }} + + - name: Send issue to the auto triager action + id: auto_triage + # https://github.com/grafana/auto-triager/blob/main/action.yml + #uses: grafana/auto-triager@main + uses: ./auto-triager + with: + token: ${{ secrets.GITHUB_TOKEN }} + issue_number: ${{ github.event.issue.number }} + openai_api_key: ${{ secrets.OPENAI_API_KEY }} + # Leaving the action in monitoring mode for now + # should be set to true when ready to use + # add_labels: true + add_labels: false + + - name: Labels from auto triage + run: | + echo ${{ steps.auto_triage.outputs.triage_labels }} + + - name: "Send Slack notification" + if : ${{ steps.auto_triage.outputs.triage_labels != '' }} + uses: slackapi/slack-github-action@v1.27.0 + with: + payload: > + { + "icon_emoji": ":robocto:", + "username": "Auto Triager", + "type": "mrkdwn", + "text": "Auto triager found the following labels: ${{ steps.auto_triage.outputs.triage_labels }} for [issue #${{ github.event.issue.number }}](${{ github.event.issue.html_url }})", + "channel": "#triage-automation-ci" + } + env: + SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}