Skip to content

Chore: Update plugin examples to latest version #94

Chore: Update plugin examples to latest version

Chore: Update plugin examples to latest version #94

name: Lapo Docs - Notify Plugin Tools on Code changes
on:
pull_request:
types: [closed]
branches: [main]
permissions:
contents: read
id-token: write
jobs:
notify-plugin-tools:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
with:
fetch-depth: 0
persist-credentials: false
- name: Check for relevant file changes
id: check_files
run: |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} $COMMIT_SHA)
echo "$CHANGED_FILES" > /tmp/changed_files.txt
if grep -i -E "\.(ts|tsx|go)$" /tmp/changed_files.txt; then
echo "has_relevant_changes=true" >> "$GITHUB_OUTPUT"
else
echo "has_relevant_changes=false" >> "$GITHUB_OUTPUT"
fi
shell: bash
env:
COMMIT_SHA: ${{ github.event.pull_request.merge_commit_sha }}
- id: get-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@get-vault-secrets/v1.3.0 # zizmor: ignore[unpinned-uses] provided by grafana
with:
export_env: false
# Secrets placed in the ci/repo/grafana/grafana-plugin-examples path in Vault
repo_secrets: |
GITHUB_APP_ID=plugins-platform-bot-app:app_id
GITHUB_APP_PRIVATE_KEY=plugins-platform-bot-app:app_pem
- name: Generate token
if: steps.check_files.outputs.has_relevant_changes == 'true'
id: generate_token
uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4
with:
app-id: ${{ fromJSON(steps.get-secrets.outputs.secrets).GITHUB_APP_ID }}
private-key: ${{ fromJSON(steps.get-secrets.outputs.secrets).GITHUB_APP_PEM }}
permission-contents: write
- name: Repository Dispatch
if: steps.check_files.outputs.has_relevant_changes == 'true'
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
with:
token: ${{ steps.generate_token.outputs.token }}
repository: grafana/plugin-tools
event-type: pr-merged
client-payload: '{"pr_url": "${{ github.event.pull_request.html_url }}"}'