mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Chore: Fix issue-labeled workflow permission errors (#93417)
* Chore: Fix issue-labeled workflow permission errors * fix comparison
This commit is contained in:
parent
bfb25e33eb
commit
eb3f64b3f8
16
.github/workflows/issue-labeled.yml
vendored
16
.github/workflows/issue-labeled.yml
vendored
@ -49,8 +49,8 @@ jobs:
|
||||
fi
|
||||
|
||||
# set environment for next steps
|
||||
echo "CHANNEL=${CHANNEL}" >> $GITHUB_ENV
|
||||
echo "TEAM=${TEAM}" >> $GITHUB_ENV
|
||||
echo "CHANNEL=${CHANNEL}" >> "$GITHUB_ENV"
|
||||
echo "TEAM=${TEAM}" >> "$GITHUB_ENV"
|
||||
|
||||
- name: "Prepare payload"
|
||||
uses: frabert/replace-string-action@v2.5
|
||||
@ -64,22 +64,22 @@ jobs:
|
||||
|
||||
- name: Get Token
|
||||
id: get_workflow_token
|
||||
uses: peter-murray/workflow-application-token-action@v3
|
||||
uses: tibdex/github-app-token@3beb63f4bd073e61482598c45c71c1019b59b73a
|
||||
with:
|
||||
application_id: ${{ secrets.APP_GRAFANA_TEAM_CHECKER_ID }}
|
||||
application_private_key: ${{ secrets.APP_GRAFANA_TEAM_CHECKER_KEY }}
|
||||
app_id: ${{ secrets.APP_GRAFANA_TEAM_CHECKER_ID }}
|
||||
private_key: ${{ secrets.APP_GRAFANA_TEAM_CHECKER_KEY }}
|
||||
|
||||
- name: "Check that issue author is not part of the team"
|
||||
if: ${{ env.TEAM != 'null' }}
|
||||
run: |
|
||||
response=$(gh api /orgs/grafana/teams/${{ env.TEAM }}/memberships/${{ github.event.issue.user.login }} -i -H "Accept: application/vnd.github.v3+json")
|
||||
STATUS_CODE=$(echo "$response" | head -n 1 | cut -d' ' -f2)
|
||||
if [ "$status_code" -eq 404 ]; then
|
||||
if [ "$STATUS_CODE" -eq "404" ]; then
|
||||
echo "The user was not found in the team."
|
||||
echo "USER_FOUND=false" >> $GITHUB_ENV
|
||||
echo "USER_FOUND=false" >> "$GITHUB_ENV"
|
||||
else
|
||||
echo "The user was potentially found in the team"
|
||||
echo "USER_FOUND=maybe" >> $GITHUB_ENV
|
||||
echo "USER_FOUND=maybe" >> "$GITHUB_ENV"
|
||||
fi
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ steps.get_workflow_token.outputs.token }}
|
||||
|
Loading…
Reference in New Issue
Block a user