An Action to get the number of GHAS seats and optionally calculate the percentage used as well as the number of seats remaining.
Warning Because the GitHub API does not return the maximum number of seats in your current plan you will need to specify this as an input to the action via the
max_advanced_security_committers
variable. If left unset the action will only return the total number of seats currently used.
Create a workflow (eg: .github/workflows/seat-count.yml
). See Creating a Workflow file.
You will need to create a PAT(Personal Access Token) that has admin:org
access.
Add this PAT as a secret so we can use it as input github-token
, see Creating encrypted secrets for a repository.
If your organization has SAML enabled you must authorize the PAT, see Authorizing a personal access token for use with SAML single sign-on.
name: Check GHAS Seats
on:
schedule:
- cron: 0 0 * * *
jobs:
seats:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: austenstone/ghas-seats-action@main
id: seats
with:
org: octodemo
github-token: ${{secrets.TOKEN}}
max_advanced_security_committers: 200
outputs:
percentage: ${{steps.seats.outputs.percentage}}
remaining: ${{steps.seats.outputs.remaining}}
more-than-90-percent:
needs: [seats]
if: needs.seats.outputs.percentage > 90
runs-on: ubuntu-latest
steps:
- run: echo More than 90% of seats used!
To count the total seats in the enterprise instead of an org specify the enterprise input variable instead.
with:
enterprise: github
Use this action in combination with other actions to notify users.
Various inputs are defined in action.yml
:
Name | Description | Default |
---|---|---|
github‑token | Token to use to authorize. | ${{ github.token }} |
org | The org to use for the action | N/A |
enterprise | The enterprise to use for the action | N/A |
max_advanced_security_committers | The maximum number of advanced security committers | N/A |
Name | Description |
---|---|
total_advanced_security_committers | The total number of seats. |
percentage | The percentage of total seats used. |
remaining | The number of remaining seats. |
To get more help on the Actions see documentation.