Update plugin examples from create-plugin #41
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: Update plugin examples from create-plugin | |
on: | |
schedule: | |
- cron: "0 0 * * 0" # Run weekly (every Sunday at midnight UTC) | |
workflow_dispatch: # Enable manual trigger | |
repository_dispatch: # To trigger from plugin-tools | |
jobs: | |
update-examples: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
pull-requests: write | |
id-token: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0 | |
with: | |
# require for PR action | |
persist-credentials: true | |
- id: get-secrets | |
uses: grafana/shared-workflows/actions/get-vault-secrets@28361cdb22223e5f1e34358c86c20908e7248760 # get-vault-secrets-v1.1.0 | |
with: | |
repo_secrets: | | |
GITHUB_APP_ID=plugins-platform-bot-app:app_id | |
GITHUB_APP_PRIVATE_KEY=plugins-platform-bot-app:app_pem | |
- uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 # v2.1.4 | |
id: generate_token | |
with: | |
app-id: ${{ env.GITHUB_APP_ID }} | |
private-key: ${{ env.GITHUB_APP_PRIVATE_KEY }} | |
permission-contents: write | |
permission-pull-requests: write | |
- name: Setup nodejs 22 | |
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0 | |
with: | |
node-version: 22 | |
- name: Generate Basic Panel | |
shell: bash | |
run: | | |
rm -rf examples/panel-basic | |
npx -y @grafana/create-plugin@latest --plugin-name=basic --org-name=myorg --plugin-type=panel --no-backend | |
mv myorg-basic-panel examples/panel-basic | |
- name: Generate Basic Datasource | |
shell: bash | |
run: | | |
rm -rf examples/datasource-basic | |
npx -y @grafana/create-plugin@latest --plugin-name=basic --org-name=myorg --plugin-type=datasource --no-backend | |
mv myorg-basic-datasource examples/datasource-basic | |
- name: Generate Basic App | |
shell: bash | |
run: | | |
rm -rf examples/app-basic | |
npx -y @grafana/create-plugin@latest --plugin-name=basic --org-name=myorg --plugin-type=app --no-backend | |
mv myorg-basic-app examples/app-basic | |
- name: Generate Backend Datasource | |
shell: bash | |
run: | | |
rm -rf examples/datasource-with-backend | |
npx -y @grafana/create-plugin@latest --plugin-name=backend --org-name=myorg --plugin-type=datasource --backend | |
mv myorg-backend-datasource examples/datasource-with-backend | |
- name: Generate Backend App | |
shell: bash | |
run: | | |
rm -rf examples/app-with-backend | |
npx -y @grafana/create-plugin@latest --plugin-name=backend --org-name=myorg --plugin-type=app --backend | |
mv myorg-backend-app examples/app-with-backend | |
- name: Run npm install for each package.json in examples | |
shell: bash | |
run: | | |
find examples -name "package.json" -execdir npm install \; | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8 | |
with: | |
title: "Chore: Update plugin examples to latest version" | |
commit-message: "Automated update to latest version" | |
body: | | |
This is an auto-generated PR | |
It updates all the examples based on the latest version of create-plugin. | |
branch: update-plugin-examples-to-latest | |
delete-branch: true | |
base: main | |
token: ${{ steps.generate_token.outputs.token }} | |