{"id":15763708,"url":"https://github.com/dacbd/gcpcc","last_synced_at":"2025-10-12T10:46:38.144Z","repository":{"id":40480948,"uuid":"448956581","full_name":"dacbd/gcpcc","owner":"dacbd","description":"Simple tool to print out the current number of compute instances on GCP","archived":false,"fork":false,"pushed_at":"2022-11-02T18:39:41.000Z","size":37,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-04-14T09:14:23.022Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dacbd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-01-17T15:53:41.000Z","updated_at":"2022-05-06T15:03:59.000Z","dependencies_parsed_at":"2023-01-04T12:21:02.714Z","dependency_job_id":null,"html_url":"https://github.com/dacbd/gcpcc","commit_stats":{"total_commits":20,"total_committers":1,"mean_commits":20.0,"dds":0.0,"last_synced_commit":"638ee9a0ae139f47632b5fa7ffd5ec1fe4e81ee6"},"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacbd%2Fgcpcc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacbd%2Fgcpcc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacbd%2Fgcpcc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dacbd%2Fgcpcc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dacbd","download_url":"https://codeload.github.com/dacbd/gcpcc/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246450478,"owners_count":20779421,"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":[],"created_at":"2024-10-04T12:00:48.389Z","updated_at":"2025-10-12T10:46:33.105Z","avatar_url":"https://github.com/dacbd.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gcpcc\n[![CodeQL](https://github.com/dacbd/gcpcc/actions/workflows/codeql-analysis.yml/badge.svg)](https://github.com/dacbd/gcpcc/actions/workflows/codeql-analysis.yml)\n\nSimple tool to print out the current number of compute instances on GCP\n\nCreated to to prefrom GitHub Actions powered automatic checks.\n\nDid someone leave a compute instance on that shouldn't be?\n\n## Config\nCurrently none, authentication credentials are read from the environment.\n\n## Authentication to GCP\n\nThere are 3 recomended approaches:\n1. Pass GCP credentials JSON directly via `GOOGLE_APPLICATION_CREDENTIALS_DATA`\n1. The [\"typical\"](https://github.com/google-github-actions/auth#authenticating-via-service-account-key-json-1) approach of `GOOGLE_APPLICATION_CREDENTIALS` (path to JSON file)\n1. Using [GitHub Actions OIDC](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/configuring-openid-connect-in-google-cloud-platform) with GCP [see here](https://github.com/google-github-actions/auth#authenticating-via-workload-identity-federation-1)\n\n#### Method 1\n```yml\n# ...\nsteps:\n  - uses: dacbd/gcpcc@v1\n    env:\n      GOOGLE_APPLICATION_CREDENTIALS_DATA: ${{ secrets.GCP_SA_KEY_JSON }}\n```\n\n#### Method 2\n```yml\n# ...\nsteps:\n  - uses: google-github-actions/auth@v0\n    with:\n      credentials_json: ${{ secrets.gcp_sa_key_json }}\n  - uses: dacbd/gcpcc@v1\n```\n\n#### Method 3\n```yml\n# ...\n# Add \"id-token\" with the intended permissions.\npermissions:\n  contents: 'read'\n  id-token: 'write'\nsteps:\n  - uses: google-github-actions/auth@v0\n    with:\n      workload_identity_provider: 'projects/123456789/locations/global/workloadIdentityPools/my-pool/providers/my-provider'\n      service_account: 'my-service-account@my-project.iam.gserviceaccount.com'\n  - uses: dacbd/gcpcc@v1\n```\n\n## Outputs\n| outputs | value |\n| ------- | ----- |\n| total   | `int` - total number of compute instance |\n\n## Usage\nBasic example:\n```yml\nname: Check ML Training instances\non:\n  schedule:\n    cron:\n     - ''\njobs:\n  check:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: actions/checkout@v3 # not technically required\n    - uses: google-github-actions/auth@v0\n      with:\n        credentials_json: ${{ secrets.GCP_SA_KEY_JSON }}\n    - uses: dacbd/gcpcc@v1\n      id: gcpcc\n    - uses: dacbd/create-issue-action@v1\n      if: steps.gcpcc.outputs.total != 0\n      with:\n        token: ${{ github.token }}\n        title: Instance left on in `${{ env.GCP_PROJECT }}`\n        assignees: dacbd,some_github_username\n        body: |\n          Automatic check found `${{ steps.gcpcc.outputs.total }}` instance\\s left on.\n```\n## Permissions\nTODO\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdacbd%2Fgcpcc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdacbd%2Fgcpcc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdacbd%2Fgcpcc/lists"}