Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
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
13 changes: 10 additions & 3 deletions .github/workflows/add-files-changed-label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
steps:
- name: Add Files Changed Label
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
PR_NUMBER: ${{ github.event.pull_request.number }}
REPO_OWNER: ${{ github.repository_owner }}
REPO_NAME: ${{ github.event.repository.name }}
Expand All @@ -33,8 +33,8 @@ jobs:
"https://api.github.com/repos/$REPO_OWNER/$REPO_NAME/pulls/$PR_NUMBER/files")

# Check if the API request was successful
if [[ "$FILES_API_RESPONSE" == *"message"*"Not Found"* ]]; then
echo "Error: Could not fetch PR files. API response indicates resource not found."
if [[ "$FILES_API_RESPONSE" == *"message"*"Not Found"* ]] || [[ "$FILES_API_RESPONSE" == *"Resource not accessible by integration"* ]]; then
echo "Error: Could not fetch PR files. Response: $FILES_API_RESPONSE"
exit 1
fi

Expand Down Expand Up @@ -141,6 +141,13 @@ jobs:
# Check if label was added successfully
if [[ "$ADD_LABEL_RESPONSE" == *"message"* ]]; then
echo "Error: Failed to add label. Response: $ADD_LABEL_RESPONSE"

# Check if it's a permissions issue and suggest using a custom token
if [[ "$ADD_LABEL_RESPONSE" == *"Resource not accessible by integration"* ]]; then
echo "This appears to be a permissions issue. Please configure a CUSTOM_GITHUB_TOKEN secret with higher permissions."
echo "See the .github/README.md file for instructions on setting up the token."
fi

exit 1
else
echo "Successfully applied label '$LABEL' to PR #$PR_NUMBER"
Expand Down
Loading