Context
When running GitHub Actions workflows that make many GitHub API calls, it is important to understand rate limit
consumption. Currently, the action provides no visibility into how many API requests have been used or remain
available for the authenticated runner. Without this information, diagnosing rate-limit-related failures requires
manually querying the API or adding temporary debugging steps to workflows.
Request
The action should optionally display the GitHub API rate limit status for the current runner — both before and
after the user script executes. Showing rate limits at both points makes it easy to see how many API calls the
script consumed during a run.
The feature should be off by default to keep logs clean for workflows that do not need this information, and
toggled on via an input parameter when visibility is needed.
Desired experience
When the feature is enabled, the action log output includes two fenced rate limit sections — one appearing before the
user script runs and one after — using the same visual border style (┏━━┫ ... ┣━━━━━━━━┓ / ┗━━━━━━━━━━━━━━━━━━┛)
used by the existing Info and Outputs sections. Each section should display rate limit details for core, search,
graphql, and other resource categories as returned by
Get-GitHubRateLimit,
including remaining quota, limit, used count, and reset time.
Acceptance criteria
- A new input parameter controls whether rate limit information is displayed, defaulting to off
- Rate limit information is displayed inside fenced borders before the user script runs
- Rate limit information is displayed inside fenced borders after the user script runs
- The output uses the same visual fence style as the existing
Info and Outputs sections
- When the feature is off (default), no rate limit output appears in the logs
- The rate limit data covers all resource categories returned by the GitHub API
(GET /rate_limit)
Technical decisions
Input naming: Add a ShowRateLimit input defaulting to 'false', following the existing convention
of ShowInfo, ShowInit, and ShowOutput.
Environment variable: Pass the value via PSMODULE_GITHUB_SCRIPT_INPUT_ShowRateLimit, consistent with
all other inputs.
Script placement: Create a new file src/ratelimit.ps1 responsible for displaying rate limit information.
This script is called twice in the action.yml run block:
- After
info.ps1 and before the user script (${{ inputs.Script }})
- After
outputs.ps1 and before the finally/clean.ps1 block
This placement ensures the rate limit borders appear inside the action's data output region, sandwiching the
user script execution.
Fence labels: Use Rate Limit (Pre) and Rate Limit (Post) as the fence title suffixes to distinguish the
two sections. The script should accept a parameter or use an environment variable to differentiate between the
pre and post invocations.
Rate limit command: Use Get-GitHubRateLimit
from the GitHub PowerShell module. This returns objects with Name, Limit, Used, Remaining, ResetsAt,
and ResetsIn properties per resource category. Display these in a formatted table inside a LogGroup for
collapsibility.
Guard pattern: Follow the same early-return pattern used in info.ps1 and outputs.ps1 — check the
environment variable at the top and return immediately if the feature is disabled:
if ($env:PSMODULE_GITHUB_SCRIPT_INPUT_ShowRateLimit -ne 'true') {
return
}
Module dependency: The script requires the GitHub module (#Requires -Modules GitHub), same as info.ps1
and outputs.ps1.
Implementation plan
Action definition
Rate limit script
Execution flow
Tests
Context
When running GitHub Actions workflows that make many GitHub API calls, it is important to understand rate limit
consumption. Currently, the action provides no visibility into how many API requests have been used or remain
available for the authenticated runner. Without this information, diagnosing rate-limit-related failures requires
manually querying the API or adding temporary debugging steps to workflows.
Request
The action should optionally display the GitHub API rate limit status for the current runner — both before and
after the user script executes. Showing rate limits at both points makes it easy to see how many API calls the
script consumed during a run.
The feature should be off by default to keep logs clean for workflows that do not need this information, and
toggled on via an input parameter when visibility is needed.
Desired experience
When the feature is enabled, the action log output includes two fenced rate limit sections — one appearing before the
user script runs and one after — using the same visual border style (
┏━━┫ ... ┣━━━━━━━━┓/┗━━━━━━━━━━━━━━━━━━┛)used by the existing Info and Outputs sections. Each section should display rate limit details for core, search,
graphql, and other resource categories as returned by
Get-GitHubRateLimit,including remaining quota, limit, used count, and reset time.
Acceptance criteria
InfoandOutputssections(
GET /rate_limit)Technical decisions
Input naming: Add a
ShowRateLimitinput defaulting to'false', following the existing conventionof
ShowInfo,ShowInit, andShowOutput.Environment variable: Pass the value via
PSMODULE_GITHUB_SCRIPT_INPUT_ShowRateLimit, consistent withall other inputs.
Script placement: Create a new file
src/ratelimit.ps1responsible for displaying rate limit information.This script is called twice in the
action.ymlrunblock:info.ps1and before the user script (${{ inputs.Script }})outputs.ps1and before thefinally/clean.ps1blockThis placement ensures the rate limit borders appear inside the action's data output region, sandwiching the
user script execution.
Fence labels: Use
Rate Limit (Pre)andRate Limit (Post)as the fence title suffixes to distinguish thetwo sections. The script should accept a parameter or use an environment variable to differentiate between the
pre and post invocations.
Rate limit command: Use
Get-GitHubRateLimitfrom the GitHub PowerShell module. This returns objects with
Name,Limit,Used,Remaining,ResetsAt,and
ResetsInproperties per resource category. Display these in a formatted table inside aLogGroupforcollapsibility.
Guard pattern: Follow the same early-return pattern used in
info.ps1andoutputs.ps1— check theenvironment variable at the top and
returnimmediately if the feature is disabled:Module dependency: The script requires the GitHub module (
#Requires -Modules GitHub), same asinfo.ps1and
outputs.ps1.Implementation plan
Action definition
ShowRateLimitinput toaction.ymlwithdescription,required: false, anddefault: 'false'PSMODULE_GITHUB_SCRIPT_INPUT_ShowRateLimit: ${{ inputs.ShowRateLimit }}to the environment variables in the composite stepRate limit script
src/ratelimit.ps1with#Requires -Modules GitHuband[CmdletBinding()] param()headerShowRateLimitis not'true'PSMODULE_GITHUB_SCRIPT_RATELIMIT_LABEL) to distinguishPrevsPost┏━━┫ {Name} - Rate Limit ({Label}) ┣━━━━━━━━┓/┗━━━━━━━━━━━━━━━━━━┛patternGet-GitHubRateLimitand display the results in a formatted table inside aLogGroupExecution flow
src/ratelimit.ps1inaction.ymlafterinfo.ps1and before${{ inputs.Script }}, setting the label toPresrc/ratelimit.ps1inaction.ymlafteroutputs.ps1and before thefinallyblock, setting the label toPostTests
tests/to verify rate limit output appears whenShowRateLimitis enabledShowRateLimitis disabled or not set