Result
The project allows you to pin the language you use most frequently.
Fork this repository and enable GitHub Actions in the Actions tab.
- Go to gist.github.com
- Create a new gist with any filename (e.g.,
top-language-usage.txt) - Add some initial content
- Create the gist (can be public or secret)
- Copy the gist ID from the URL
Example: https://gist.github.com/username/f5ebdde2b6a31849520797f9f4e49831 β Use this part
- Go to GitHub Settings β Tokens
- Click "Generate new token" β "Generate new token (classic)"
- Give it a descriptive name (e.g., "Top-Language-Box")
- Select the following scopes:
- β
gist- Create gists - β
repo- Full control of private repositories (needed to read your repos)
- β
- Click "Generate token"
- Copy the token immediately (you won't be able to see it again!)
- Go to your forked repository
- Navigate to Settings β Secrets and variables β Actions
- Click "New repository secret"
- Add the following secrets:
- Name:
GH_TOKEN
Value: Your Personal Access Token from Step 3 - Name:
GH_GISTID
Value: Your Gist ID from Step 2
- Name:
- Go to the Actions tab in your repository
- Select "Build" workflow
- Click "Run workflow" β "Run workflow"
- Wait for the workflow to complete
- Check your gist to see if it was updated!
To test locally:
# Install dependencies
npm install
# Set environment variables
export USER_NAME=your-github-username
export GH_TOKEN=your-github-token
export GH_GISTID=your-gist-id
# Run the script
npm startThis error means your GitHub token is not valid or not properly configured:
-
Check if secrets are set correctly
- Go to your repository Settings β Secrets and variables β Actions
- Verify that
GH_TOKENandGH_GISTIDare present - The secrets should not have extra spaces or quotes
-
Regenerate your token
- Your token might have expired
- Go to GitHub Settings β Tokens
- Delete the old token and create a new one
- Make sure to select both
repoandgistscopes - Update the
GH_TOKENsecret in your repository
-
Test with manual workflow trigger
- Go to Actions tab β Build workflow
- Click "Run workflow" to test immediately
- Check the logs for detailed error messages
This usually means:
- Your GitHub username is incorrect
- Your repositories are all empty
- API rate limit exceeded
- Check the Actions tab for error logs
- Verify the Gist ID is correct (just the ID part, not the full URL)
- Make sure the gist exists and you have permission to edit it
Inspered bygithub_readme_state and productive-box. 2023.06.15
