Skip to content
Draft
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
16 changes: 14 additions & 2 deletions .github/workflows/add-files-changed-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ jobs:
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/labels")

ALL_REPO_LABELS=$(echo "$ALL_LABELS_RESPONSE" | jq -r '.[].name')
# Check if the API request was successful before processing
if echo "$ALL_LABELS_RESPONSE" | jq -e 'type == "array"' > /dev/null 2>&1; then
ALL_REPO_LABELS=$(echo "$ALL_LABELS_RESPONSE" | jq -r '.[].name')
else
echo "Error: Could not fetch repository labels. Response: $ALL_LABELS_RESPONSE"
exit 1
fi

# Create the label if it doesn't exist
if ! echo "$ALL_REPO_LABELS" | grep -q "$LABEL"; then
Expand Down Expand Up @@ -118,7 +124,13 @@ jobs:
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/issues/$PR_NUMBER/labels")

EXISTING_LABELS=$(echo "$PR_LABELS_RESPONSE" | jq -r '.[].name')
# Check if the API request was successful before processing
if echo "$PR_LABELS_RESPONSE" | jq -e 'type == "array"' > /dev/null 2>&1; then
EXISTING_LABELS=$(echo "$PR_LABELS_RESPONSE" | jq -r '.[].name')
else
echo "Error: Could not fetch PR labels. Response: $PR_LABELS_RESPONSE"
exit 1
fi

# Remove any existing files-changed labels
echo "Checking for existing 'files-changed' labels to remove..."
Expand Down