This file contains 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: Issue Opened Action | |
on: | |
issues: | |
types: [opened] | |
permissions: | |
contents: read | |
id-token: write | |
jobs: | |
main: | |
runs-on: ubuntu-latest | |
steps: | |
- name: "Get vault secrets" | |
id: vault-secrets | |
uses: grafana/shared-workflows/actions/get-vault-secrets@main | |
with: | |
# Secrets placed in the ci/repo/grafana/<repo>/<path> path in Vault | |
repo_secrets: | | |
APP_ID=triager_bot_github:app_id | |
APP_PEM=triager_bot_github:app_pem | |
- name: "Generate token" | |
id: generate_token | |
uses: tibdex/github-app-token@b62528385c34dbc9f38e5f4225ac829252d1ea92 | |
with: | |
app_id: ${{ env.APP_ID }} | |
private_key: ${{ env.APP_PEM }} | |
- name: Check org membership | |
id: check_membership | |
run: | | |
STATUS=$(curl -L -s -o /dev/null -w "%{http_code}" \ | |
-H "Accept: application/vnd.github+json" \ | |
-H "Authorization: Bearer ${{ steps.generate_token.outputs.token }}" \ | |
-H "X-GitHub-Api-Version: 2022-11-28" \ | |
"https://api.github.com/orgs/grafana/members/adela-almasan") | |
echo "HTTP Status code was: $STATUS" | |
if [ "$STATUS" = "204" ]; then | |
echo "is_member=true" >> "$GITHUB_OUTPUT" | |
else | |
echo "is_member=false" >> "$GITHUB_OUTPUT" | |
fi | |
- name: Debug membership status | |
run: | | |
echo "Checking membership for user: ${{ github.event.issue.user.login }}" | |
echo "HTTP Status code was: $STATUS" | |
echo "Output status is: ${{ steps.check_membership.outputs.is_member }}" | |
if [ "${{ steps.check_membership.outputs.is_member }}" = "true" ]; then | |
echo "✅ User ${{ github.event.issue.user.login }} is a member of the organization" | |
else | |
echo "❌ User ${{ github.event.issue.user.login }} is NOT a member of the organization" | |
fi |