CI: Run auto-milestone on pull_request_target for forks (#89410)

* CI: Run auto-milestone on pull_request_target for forks

* remove milestone check
This commit is contained in:
Josh Hunt 2024-06-24 11:18:30 +01:00 committed by GitHub
parent 2bc75016da
commit 51afe257a3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 31 deletions

View File

@ -1,11 +1,4 @@
[ [
{
"type": "check-milestone",
"title": "Milestone Check",
"targetUrl": "https://github.com/grafana/grafana/blob/main/contribute/merge-pull-request.md#assign-a-milestone",
"success": "Milestone set",
"failure": "Milestone not set"
},
{ {
"type": "check-changelog", "type": "check-changelog",
"title": "Changelog Check", "title": "Changelog Check",

View File

@ -1,39 +1,26 @@
name: Auto-milestone name: Auto-milestone
on: on:
pull_request: pull_request_target:
types: types:
- opened - opened
- reopened - reopened
- closed - closed
- ready_for_review
permissions:
pull-requests: write
# Note: this action runs with write permissions on GITHUB_TOKEN even from forks
# so it must not run untrusted code (such as checking out the pull request)
jobs: 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 != '') || '' }}" ]; then
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
fi
main: main:
needs: config
if: needs.config.outputs.has-secrets
runs-on: ubuntu-latest runs-on: ubuntu-latest
if: github.event.pull_request.draft == false
steps: steps:
- name: "Generate token" # Note: Github will not trigger other actions from this because it uses
id: generate_token # the GITHUB_TOKEN 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: Run auto-milestone - name: Run auto-milestone
uses: grafana/grafana-github-actions-go/auto-milestone@main uses: grafana/grafana-github-actions-go/auto-milestone@main
with: with:
pr: ${{ github.event.pull_request.number }} pr: ${{ github.event.pull_request.number }}
token: ${{ steps.generate_token.outputs.token }} token: ${{ secrets.GITHUB_TOKEN }}