Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix:update auto-label.yml #6372

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/auto-label.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Devtron-auto-labeller
name: Devtron-auto-labeler

on:
issue_comment:
Expand All @@ -25,11 +25,11 @@ jobs:
ISSUE_NUMBER=$(jq -r '.issue.number // .pull_request.number' "$GITHUB_EVENT_PATH")
COMMENT_AUTHOR=$(jq -r '.comment.user.login' "$GITHUB_EVENT_PATH")

ORG_NAME="satyam-tests"
ORG_NAME="devtron-labs"

# Check if the person is authorized to add labels
curl -s -H "Authorization: token $GH_TOKEN" "https://api.github.com/orgs/$ORG_NAME/members/$COMMENT_AUTHOR" > /dev/null
if [[ $? -ne 0 ]]; then
RESPONSE=$(curl -s -o /dev/null -w "%{http_code}" -H "Authorization: token $GH_TOKEN" "https://api.github.com/orgs/$ORG_NAME/members/$COMMENT_AUTHOR")
if [[ "$RESPONSE" -ne 204 ]]; then
gh issue comment "$ISSUE_NUMBER" --body "Hi @$COMMENT_AUTHOR, you must be a member of the organization '$ORG_NAME' to add or remove labels."
echo "User '$COMMENT_AUTHOR' is not a member of the organization '$ORG_NAME'. Exiting."
exit 1
Expand All @@ -53,7 +53,7 @@ jobs:
fi
fi

# Remove Label Logic
# Removes Label Logic
if [[ "$COMMENT_BODY" =~ ^/remove[[:space:]](.+)$ ]]; then
LABEL_NAME_TO_REMOVE=$(echo "$COMMENT_BODY" | sed -n 's|/remove ||p')

Expand All @@ -64,4 +64,4 @@ jobs:
else
echo "The label '$LABEL_NAME_TO_REMOVE' is not attached to issue #$ISSUE_NUMBER."
fi
fi
fi
Loading