2021-03-17 06:49:57 -05:00
|
|
|
name: PR automation
|
|
|
|
on:
|
|
|
|
pull_request_target:
|
|
|
|
types:
|
2023-03-08 03:00:58 -06:00
|
|
|
- labeled
|
2021-03-17 06:49:57 -05:00
|
|
|
- opened
|
|
|
|
- synchronize
|
2022-02-10 07:01:18 -06:00
|
|
|
concurrency:
|
2022-03-01 04:09:03 -06:00
|
|
|
group: pr-commands-${{ github.event.number }}
|
2021-03-17 06:49:57 -05:00
|
|
|
jobs:
|
2023-08-02 06:25:23 -05:00
|
|
|
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_PR_AUTOMATION_APP_ID != '' &&
|
|
|
|
secrets.GRAFANA_PR_AUTOMATION_APP_PEM != '' &&
|
|
|
|
secrets.GRAFANA_MISC_STATS_API_KEY != ''
|
|
|
|
) || '' }}" ]; then
|
|
|
|
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
|
|
|
|
fi
|
|
|
|
|
2021-03-17 06:49:57 -05:00
|
|
|
main:
|
2023-08-02 06:25:23 -05:00
|
|
|
needs: config
|
|
|
|
if: needs.config.outputs.has-secrets
|
2021-03-17 06:49:57 -05:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout Actions
|
2023-09-05 03:10:10 -05:00
|
|
|
uses: actions/checkout@v4
|
2021-03-17 06:49:57 -05:00
|
|
|
with:
|
|
|
|
repository: "grafana/grafana-github-actions"
|
|
|
|
path: ./actions
|
|
|
|
ref: main
|
|
|
|
- name: Install Actions
|
|
|
|
run: npm install --production --prefix ./actions
|
2023-07-26 15:48:32 -05:00
|
|
|
- name: "Generate token"
|
|
|
|
id: generate_token
|
|
|
|
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92
|
|
|
|
with:
|
|
|
|
app_id: ${{ secrets.GRAFANA_PR_AUTOMATION_APP_ID }}
|
|
|
|
private_key: ${{ secrets.GRAFANA_PR_AUTOMATION_APP_PEM }}
|
2021-03-17 06:49:57 -05:00
|
|
|
- name: Run Commands
|
|
|
|
uses: ./actions/commands
|
|
|
|
with:
|
|
|
|
metricsWriteAPIKey: ${{secrets.GRAFANA_MISC_STATS_API_KEY}}
|
2023-07-26 15:48:32 -05:00
|
|
|
token: ${{ steps.generate_token.outputs.token }}
|
2021-03-17 06:49:57 -05:00
|
|
|
configPath: pr-commands
|