{"id":16123590,"url":"https://github.com/austenstone/copilot-license-cleanup","last_synced_at":"2025-03-16T08:32:53.421Z","repository":{"id":191679524,"uuid":"685168728","full_name":"austenstone/copilot-license-cleanup","owner":"austenstone","description":"Automatically remove inactive Copilot licenses","archived":false,"fork":false,"pushed_at":"2025-03-12T14:57:13.000Z","size":2245,"stargazers_count":17,"open_issues_count":10,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-12T15:35:05.345Z","etag":null,"topics":["actions","copilot","github"],"latest_commit_sha":null,"homepage":"https://github.com/austenstone/copilot-license-cleanup","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/austenstone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["austenstone"]}},"created_at":"2023-08-30T16:52:41.000Z","updated_at":"2025-03-12T14:57:17.000Z","dependencies_parsed_at":"2023-08-31T04:30:26.350Z","dependency_job_id":"99815f5f-62cf-4059-8b05-0535a07a909a","html_url":"https://github.com/austenstone/copilot-license-cleanup","commit_stats":null,"previous_names":["austenstone/copilot-license-cleanup"],"tags_count":6,"template":false,"template_full_name":"austenstone/action-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fcopilot-license-cleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fcopilot-license-cleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fcopilot-license-cleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/austenstone%2Fcopilot-license-cleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/austenstone","download_url":"https://codeload.github.com/austenstone/copilot-license-cleanup/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243809865,"owners_count":20351403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["actions","copilot","github"],"created_at":"2024-10-09T21:17:33.129Z","updated_at":"2025-03-16T08:32:53.408Z","avatar_url":"https://github.com/austenstone.png","language":"TypeScript","funding_links":["https://github.com/sponsors/austenstone"],"categories":[],"sub_categories":[],"readme":"# Copilot License Management\n\nRun this action on a schedule to automatically remove inactive Copilot licenses. It also creates a report as a job summary and csv.\n\n## Usage\nCreate a workflow (eg: `.github/workflows/copilot-license-management.yml`). See [Creating a Workflow file](https://help.github.com/en/articles/configuring-a-workflow#creating-a-workflow-file).\n\n### PAT(Personal Access Token)\n\nYou will need to [create a PAT(Personal Access Token)](https://github.com/settings/tokens/new?scopes=manage_billing:copilot) that has `manage_billing:copilot` access.  If you are specifying an 'enterprise' rather than individual organizations you must also include the `read:org` and `read:enterprise` scopes. \n\nAdd this PAT as a secret `TOKEN` so we can use it for input `github-token`, see [Creating encrypted secrets for a repository](https://docs.github.com/en/enterprise-cloud@latest/actions/security-guides/encrypted-secrets#creating-encrypted-secrets-for-a-repository). \n### Organizations\n\nIf your organization has SAML enabled you must authorize the PAT, see [Authorizing a personal access token for use with SAML single sign-on](https://docs.github.com/en/enterprise-cloud@latest/authentication/authenticating-with-saml-single-sign-on/authorizing-a-personal-access-token-for-use-with-saml-single-sign-on).\n\n\n#### Example\n```yml\nname: Cleanup Copilot Licenses\non:\n  workflow_dispatch:\n  schedule:\n    - cron: '0 0 * * *'\n\njobs:\n  copilot:\n    name: Copilot Seats\n    runs-on: ubuntu-latest\n    steps:\n      - uses: austenstone/copilot-license-cleanup@v1.5\n        with:\n          github-token: ${{ secrets.TOKEN }}\n```\n\n#### Example Auto remove\n```yml\n      - uses: austenstone/copilot-license-cleanup@v1.5\n        with:\n          github-token: ${{ secrets.TOKEN }}\n          remove: true\n          remove-from-team: true\n```\n\n#### Example Custom days before inactive\n```yml\n      - uses: austenstone/copilot-license-cleanup@v1.5\n        with:\n          github-token: ${{ secrets.TOKEN }}\n          remove: true\n          remove-from-team: true\n          inactive-days: 10\n```\n\n#### Example Specifying multiple organizations: \n```yml\n      - uses: austenstone/copilot-license-cleanup@v1.5\n        with:\n          github-token: ${{ secrets.TOKEN }}\n          organization: exampleorg1, demoorg2, myorg3\n```\n\n#### Example specifying a GitHub Enterprise (to run on all organizations in the enterprise):\n```yml\n      - uses: austenstone/copilot-license-cleanup@v1.5\n        with:\n          github-token: ${{ secrets.TOKEN }}\n          enterprise: myenterprise\n```\n\n#### Example uploading inactive users JSON artifact\n```yml\n      - uses: austenstone/copilot-license-cleanup@v1.5\n        id: copilot\n        with:\n          github-token: ${{ secrets.TOKEN }}\n      - name: Save inactive seats JSON to a file\n        run: |\n          echo '${{ steps.copilot.outputs.inactive-seats }}' | jq . \u003e inactive-seats.json\n      - name: Upload inactive seats JSON as artifact\n        uses: actions/upload-artifact@v4\n        with:\n          name: inactive-seats-json\n          path: inactive-seats.json\n```\n\n## ➡️ Inputs\nVarious inputs are defined in [`action.yml`](action.yml):\n\n| Name | Description | Default |\n| --- | - | - |\n| **github\u0026#x2011;token** | Token to use to authorize. | ${{\u0026nbsp;github.token\u0026nbsp;}} |\n| organization | The organization(s) to use for the action (comma separated)| ${{\u0026nbsp;github.repository_owner\u0026nbsp;}} |\n| enterprise | (optional) All organizations in this enterprise (overrides organization) | null |\n| remove | Whether to remove inactive users | false |\n| remove-from-team | Whether to remove inactive users from their assigning team | false |\n| inactive\u0026#x2011;days | The number of days to consider a user inactive | 90 |\n| job-summary | Whether to output a summary of the job | true |\n| csv | Whether to output a CSV of inactive users | false |\n\n## ⬅️ Outputs\n| Name | Description |\n| --- | - |\n| inactive-seats | JSON array of inactive seats |\n| inactive-seat-count | The number of inactive seats |\n| removed-seats | The number of seats removed |\n| seat-count | The total number of seats |\n\n## How does it work?\nWe're simply leveraging the [GitHub Copilot API](https://docs.github.com/en/rest/copilot). First we fetch all the Copilot seats and filter them to only inactive seats. Then if the seat is assigned directly we remove it but if it's assigned through a team we remove the user from the team. Those inactive users are reported as a CSV and a job summary table.\n\n## Further help\nTo get more help on the Actions see [documentation](https://docs.github.com/en/actions).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustenstone%2Fcopilot-license-cleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Faustenstone%2Fcopilot-license-cleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Faustenstone%2Fcopilot-license-cleanup/lists"}