mirror of
https://github.com/grafana/grafana.git
synced 2024-11-21 16:38:03 -06:00
Chore: Fix dashboards label adding workflow (#95778)
* change auth for dashboards workflow * fix * fix * final changes/ tested action * fix
This commit is contained in:
parent
e6353dcd68
commit
34991f5b44
42
.github/workflows/dashboards-issue-add-label.yml
vendored
42
.github/workflows/dashboards-issue-add-label.yml
vendored
@ -3,8 +3,11 @@ on:
|
|||||||
issues:
|
issues:
|
||||||
types: [opened, closed, edited, reopened, assigned, unassigned, labeled, unlabeled]
|
types: [opened, closed, edited, reopened, assigned, unassigned, labeled, unlabeled]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
id-token: write
|
||||||
|
|
||||||
env:
|
env:
|
||||||
GITHUB_TOKEN: ${{ secrets.ISSUE_COMMANDS_TOKEN }}
|
|
||||||
ORGANIZATION: ${{ github.repository_owner }}
|
ORGANIZATION: ${{ github.repository_owner }}
|
||||||
REPO: ${{ github.event.repository.name }}
|
REPO: ${{ github.event.repository.name }}
|
||||||
TARGET_PROJECT: 202
|
TARGET_PROJECT: 202
|
||||||
@ -13,27 +16,28 @@ env:
|
|||||||
concurrency:
|
concurrency:
|
||||||
group: issue-label-when-in-project-${{ github.event.number }}
|
group: issue-label-when-in-project-${{ github.event.number }}
|
||||||
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.ISSUE_COMMANDS_TOKEN != '') || '' }}" ]; then
|
|
||||||
echo "has-secrets=1" >> "$GITHUB_OUTPUT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
main:
|
main:
|
||||||
needs: config
|
if: github.repository == 'grafana/grafana'
|
||||||
if: needs.config.outputs.has-secrets
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: log in
|
- name: "Get vault secrets"
|
||||||
run: gh api user -q .login
|
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: Check if issue is in target project
|
- name: Check if issue is in target project
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
gh api graphql -f query='
|
gh api graphql -f query='
|
||||||
query($org: String!, $repo: String!) {
|
query($org: String!, $repo: String!) {
|
||||||
@ -62,6 +66,8 @@ jobs:
|
|||||||
done
|
done
|
||||||
- name: Add label to issue
|
- name: Add label to issue
|
||||||
if: env.IN_TARGET_PROJ
|
if: env.IN_TARGET_PROJ
|
||||||
|
env:
|
||||||
|
GH_TOKEN: ${{ steps.generate_token.outputs.token }}
|
||||||
run: |
|
run: |
|
||||||
gh api graphql -f query='
|
gh api graphql -f query='
|
||||||
mutation ($labelableId: ID!, $labelIds: [ID!]!) {
|
mutation ($labelableId: ID!, $labelIds: [ID!]!) {
|
||||||
|
Loading…
Reference in New Issue
Block a user