Chore: Action to add issues to Skye project board (#104102)

* Chore: Action to add issues to Skye project board

* codeowners
This commit is contained in:
Josh Hunt
2025-04-16 14:48:34 +01:00
committed by GitHub
parent 45092261ab
commit 2208a24c72
2 changed files with 76 additions and 0 deletions
+1
View File
@@ -828,6 +828,7 @@ embed.go @grafana/grafana-as-code
/.github/workflows/analytics-events-report.yml @grafana/grafana-frontend-platform
/.github/workflows/pr-e2e-tests.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/run-e2e-suite.yml @grafana/grafana-developer-enablement-squad
/.github/workflows/skye-add-to-project.yml @grafana/grafana-frontend-platform
# Generated files not requiring owner approval
/packages/grafana-data/src/types/featureToggles.gen.ts @grafanabot
+75
View File
@@ -0,0 +1,75 @@
name: Add new issues/PRs to project
on:
issues:
types: [opened]
pull_request:
types: [opened]
# permissions:
# contents: read
# id-token: write
env:
ORGANIZATION: grafana
REPO: grafana
PROJECT_ID: "PVT_kwDOAG3Mbc4AxfcI" # Retrieved manually from GitHub GraphQL Explorer
concurrency:
group: skye-add-to-project-${{ github.event.number }}
jobs:
main:
if: github.repository == 'grafana/grafana'
runs-on: ubuntu-latest
steps:
- name: "Get vault secrets"
id: vault-secrets
uses: grafana/shared-workflows/actions/get-vault-secrets@main
with:
# Vault secret paths:
# - ci/repo/grafana/grafana/plugins_platform_issue_commands_github_bot
# - ci/repo/grafana/grafana/frontend_platform_skye_usernames (comma separated list of usernames)
repo_secrets: |
GH_APP_ID=plugins_platform_issue_commands_github_bot:app_id
GH_APP_PEM=plugins_platform_issue_commands_github_bot:app_pem
ALLOWED_USERS=frontend_platform_skye_usernames:allowed_users
- 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 user is allowed
id: check_user
run: |
# Convert the comma-separated list to an array
IFS=',' read -ra ALLOWED_USERS <<< "${{ env.ALLOWED_USERS }}"
USERNAME="${{ github.event.sender.login }}"
# Check if user is in the allowed list
for allowed_user in "${ALLOWED_USERS[@]}"; do
if [ "$allowed_user" = "$USERNAME" ]; then
echo "user_allowed=true" >> $GITHUB_OUTPUT
exit 0
fi
done
echo "user_allowed=false" >> $GITHUB_OUTPUT
- name: Add to project board
if: steps.check_user.outputs.user_allowed == 'true'
uses: octokit/graphql-action@v2.x
with:
projectid: ${{ env.PROJECT_ID }}
itemid: ${{ env.PULL_REQUEST_ID }}
query: |
mutation addPullRequestToProject($projectid: ID!, $itemid: ID!){
addProjectV2ItemById(input: {projectId: $projectid, contentId: $itemid}) {
item {
id
}
}
}
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}