This directory contains GitHub Actions workflows used for automating various tasks in the BLT project.
For some workflows like adding labels to issues and pull requests, you may need to set up a custom GitHub token with elevated permissions.
The default GITHUB_TOKEN
provided by GitHub Actions has certain permission limitations. For operations like creating labels or adding labels to issues and PRs, we recommend using a Personal Access Token (PAT) with appropriate permissions.
-
Go to your GitHub account settings
-
Navigate to Developer settings > Personal Access Tokens > Fine-grained tokens
-
Click "Generate new token"
-
Provide a suitable name like "BLT Workflow Token"
-
Set the expiration as needed
-
For repository access, select "Only select repositories" and choose the BLT repository
-
Under permissions, grant the following:
- Repository permissions:
- Issues: Read and write
- Pull requests: Read and write
- Contents: Read and write
- Administration: Read and write (needed for label management)
- Metadata: Read-only (automatically selected)
- Repository permissions:
-
Click "Generate token" and copy the token value
- Go to the BLT repository on GitHub
- Navigate to Settings > Secrets and variables > Actions
- Click "New repository secret"
- Name it
CUSTOM_GITHUB_TOKEN
- Paste the token value and click "Add secret"
The workflows are configured to use CUSTOM_GITHUB_TOKEN
if available, falling back to the default GITHUB_TOKEN
if not.
Example usage in workflow:
env:
GITHUB_TOKEN: ${{ secrets.CUSTOM_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
If you encounter permission errors like Resource not accessible by integration
, it's likely that:
- The token doesn't have the necessary permissions
- The token has expired
- The workflow permissions at the top of the .yml file need to be adjusted
For label-related operations specifically:
- Ensure your CUSTOM_GITHUB_TOKEN has "Administration: Read and write" permissions
- Make sure the workflow has
repository-projects: write
permission as well as other necessary permissions
Review the permissions in both your custom token and at the workflow level to resolve such issues.