The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/.github/workflows/issue-opened.yml

113 lines
4.1 KiB

name: Run commands when issues are opened
# important: this workflow uses a github app that is strictly limited
# to issues. If you want to change the triggers for this workflow,
# please review if the permissions are still sufficient.
on:
issues:
types: [opened]
concurrency:
group: issue-opened-${{ github.event.issue.number }}
permissions:
contents: read
id-token: write
jobs:
main:
runs-on: ubuntu-latest
if: github.repository == 'grafana/grafana'
steps:
- name: Checkout Actions
uses: actions/checkout@v4
with:
repository: "grafana/grafana-github-actions"
path: ./actions
ref: main
- name: Install Actions
run: npm install --production --prefix ./actions
# give issue-openers a chance to add labels after submit
- name: Sleep for 2 minutes
run: sleep 2m
shell: bash
- name: "Get vault secrets"
id: vault-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
# Secrets placed in the ci/repo/grafana/grafana/plugins_platform_issue_commands_github_bot path in Vault
repo_secrets: |
GH_APP_ID=plugins_platform_issue_commands_github_bot:app_id
GH_APP_PEM=plugins_platform_issue_commands_github_bot:app_pem
- name: "Generate token"
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
with:
app_id: ${{ env.GH_APP_ID }}
private_key: ${{ env.GH_APP_PEM }}
- name: Run Commands
uses: ./actions/commands
with:
metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}}
token: ${{ steps.generate_token.outputs.token }}
configPath: "issue-opened"
auto-triage:
needs: [main]
if: github.repository == 'grafana/grafana' && github.event.issue.author_association != 'MEMBER' && github.event.issue.author_association != 'OWNER'
runs-on: ubuntu-latest
steps:
- name: "Get vault secrets"
id: vault-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
# Secrets placed in the ci/repo/grafana/grafana/plugins_platform_issue_triager path in Vault
repo_secrets: |
AUTOTRIAGER_OPENAI_API_KEY=plugins_platform_issue_triager:AUTOTRIAGER_OPENAI_API_KEY
AUTOTRIAGER_SLACK_WEBHOOK_URL=plugins_platform_issue_triager:AUTOTRIAGER_SLACK_WEBHOOK_URL
GH_APP_ID=plugins_platform_issue_commands_github_bot:app_id
GH_APP_PEM=plugins_platform_issue_commands_github_bot:app_pem
- name: "Generate token"
id: generate_token
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
with:
app_id: ${{ env.GH_APP_ID }}
private_key: ${{ env.GH_APP_PEM }}
- name: Checkout
uses: actions/checkout@v4
- name: Send issue to the auto triager action
id: auto_triage
uses: grafana/auto-triager@main
with:
token: ${{ steps.generate_token.outputs.token }}
issue_number: ${{ github.event.issue.number }}
openai_api_key: ${{ env.AUTOTRIAGER_OPENAI_API_KEY }}
add_labels: true
labels_file: ${{ github.workspace }}/.github/workflows/auto-triager/labels.txt
types_file: ${{ github.workspace }}/.github/workflows/auto-triager/types.txt
prompt_file: ${{ github.workspace }}/.github/workflows/auto-triager/prompt.txt
- 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.html_url }}",
"channel": "#triage-automation-ci"
}
env:
SLACK_WEBHOOK_URL: ${{ env.AUTOTRIAGER_SLACK_WEBHOOK_URL }}