{"id":15062514,"url":"https://github.com/mansagroup/gcs-cache-action","last_synced_at":"2025-10-05T04:31:50.224Z","repository":{"id":36990824,"uuid":"449248040","full_name":"MansaGroup/gcs-cache-action","owner":"MansaGroup","description":"A GitHub Action to cache your workload to a Google Cloud Storage bucket.","archived":true,"fork":false,"pushed_at":"2023-06-01T19:27:50.000Z","size":2540,"stargazers_count":14,"open_issues_count":11,"forks_count":18,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-03-15T01:02:52.659Z","etag":null,"topics":["cache","gcs","github-action","github-actions","google-cloud","google-cloud-platform","google-cloud-storage"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/MansaGroup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","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}},"created_at":"2022-01-18T10:57:55.000Z","updated_at":"2024-01-12T18:26:18.000Z","dependencies_parsed_at":"2024-09-24T23:41:54.031Z","dependency_job_id":"6d7cd124-e060-4dd8-abf1-1706ff32e0fa","html_url":"https://github.com/MansaGroup/gcs-cache-action","commit_stats":{"total_commits":197,"total_committers":6,"mean_commits":"32.833333333333336","dds":0.5431472081218274,"last_synced_commit":"867797f1a78d69e008ad0a321c1459ddd619e9fd"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansaGroup%2Fgcs-cache-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansaGroup%2Fgcs-cache-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansaGroup%2Fgcs-cache-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/MansaGroup%2Fgcs-cache-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/MansaGroup","download_url":"https://codeload.github.com/MansaGroup/gcs-cache-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235364890,"owners_count":18978259,"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":["cache","gcs","github-action","github-actions","google-cloud","google-cloud-platform","google-cloud-storage"],"created_at":"2024-09-24T23:41:51.232Z","updated_at":"2025-10-05T04:31:44.743Z","avatar_url":"https://github.com/MansaGroup.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![Banner](.github/assets/banner-thin.png)\n\n# Google Cloud Storage Cache Action\n\n![License](https://img.shields.io/github/license/MansaGroup/gcs-cache-action?style=flat-square) ![GitHub Issues](https://img.shields.io/github/issues/mansagroup/gcs-cache-action?style=flat-square) ![GitHub Stars](https://img.shields.io/github/stars/MansaGroup/gcs-cache-action?style=flat-square)\n\nGitHub already provides an awesome action to cache your workload\nto Azure's servers hosted in United States. However, if you are\nusing self-hosted runners hosted far away from the cache location,\nor if you pay external network way more than internal network,\nyou may want to host your cache elsewhere for better performance\nand lower costs.\n\nThis action does have the same set of inputs as the `@actions/cache`\naction from GitHub, in addition to a new `bucket` input which should\ncontain your target Google Cloud Storage bucket. **As simple as that.**\n\n## Usage\n\n\u003e workflow.yml\n\n```yaml\n- name: Authenticate to Google Cloud\n  uses: google-github-actions/auth@v0\n  with:\n    workload_identity_provider: projects/your-project-id/locations/global/workloadIdentityPools/your-identity-pool/providers/your-provider\n    service_account: github-ci@your-project.iam.gserviceaccount.com\n\n- name: Cache the node_modules\n  id: node-modules-cache\n  uses: mansagroup/gcs-cache-action@v2\n  with:\n    bucket: my-ci-cache\n    path: node_modules\n    key: node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}\n    restore-keys: |\n      node-modules-${{ runner.os }}-\n\n- name: Install dependencies\n  if: steps.node-modules-cache.outputs.cache-hit == 'false'\n  run: npm ci\n```\n\n## Inputs\n\nThis GitHub action can take several inputs to configure its behaviors:\n\n| Name         | Type     | Default | Example                                                               | Description                                                       |\n| ------------ | -------- | ------- | --------------------------------------------------------------------- | ----------------------------------------------------------------- |\n| bucket       | String   | ø       | `my-ci-cache`                                                         | The name of the Google Cloud Storage bucket to use                |\n| path         | String[] | ø       | `node_modules`                                                        | One or more path to store                                         |\n| key          | String   | ø       | `node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}` | Key to use as cache name                                          |\n| restore-keys | String[] | ø       | `node-modules-${{ runner.os }}-`                                      | Alternative keys to use when looking for the best cache available |\n\n**Note**: the `path` and `restore-keys` inputs can contains multiple value separated by a new line.\n\n## Outputs\n\nThis GitHub action will output the following values:\n\n| Name      | Type   | Description                                                          |\n| --------- | ------ | -------------------------------------------------------------------- |\n| cache-hit | String | A boolean string representing if the cache was successfully restored |\n\n## Examples\n\n### With multiple paths\n\n\u003e workflow.yml\n\n```yaml\n- name: Authenticate to Google Cloud\n  uses: google-github-actions/auth@v0\n  with:\n    workload_identity_provider: projects/your-project-id/locations/global/workloadIdentityPools/your-identity-pool/providers/your-provider\n    service_account: github-ci@your-project.iam.gserviceaccount.com\n\n- name: Cache the node_modules and npm cache\n  id: node-modules-cache\n  uses: mansagroup/gcs-cache-action@v2\n  with:\n    bucket: my-ci-cache\n    path: |\n      node_modules\n      ~/.npm\n    key: npm-and-node-modules-${{ runner.os }}-${{ hashFiles('package-lock.json') }}\n    restore-keys: |\n      npm-and-node-modules-${{ runner.os }}-\n```\n\n## Compression algorithm\n\nWhen compressing or decompressing the cache archive, the action will\nlookup for the best compression algorithm to use. If `zstd` is available,\nit will be used instead of `gzip` by default. The compression method\nwill be added to the object's metadata on the Bucket. Thanks to this,\nwhen decompressing, the correct algorithm will be used.\n\n\u003e Installing `zstd` on Ubuntu is simple as doing a `apt install zstd`.\n\n\u003e Note that if a cache archive was compressed using one algorithm, this\n\u003e same algorithm should be installed to decompress it after.\n\n## Terraform\n\nHere is a little snippet allowing you to create your cache bucket with\n**[Terraform](https://www.terraform.io/)** _(which you should probably use)_:\n\n```terraform\nresource \"google_storage_bucket\" \"ci_cache\" {\n  name                        = \"your-ci-cache\"\n  location                    = \"your-location\" # \"EUROPE-WEST1\"\n  uniform_bucket_level_access = true\n\n  lifecycle_rule {\n    action {\n      type = \"Delete\"\n    }\n\n    condition {\n      age = 7\n    }\n  }\n}\n\nresource \"google_storage_bucket_iam_member\" \"ci_cache_write_github_ci\" {\n  bucket = google_storage_bucket.ci_cache.name\n  role   = \"roles/storage.objectCreator\"\n  member = \"serviceAccount:github-ci@your-project.iam.gserviceaccount.com\"\n}\n\nresource \"google_storage_bucket_iam_member\" \"ci_cache_read_github_ci\" {\n  bucket = google_storage_bucket.ci_cache.name\n  role   = \"roles/storage.objectViewer\"\n  member = \"serviceAccount:github-ci@your-project.iam.gserviceaccount.com\"\n}\n\nresource \"google_storage_bucket_iam_member\" \"ci_cache_legacy_write_github_ci\" {\n  bucket = google_storage_bucket.ci_cache.name\n  role   = \"roles/storage.legacyBucketWriter\"\n  member = \"serviceAccount:github-ci@your-project.iam.gserviceaccount.com\"\n}\n```\n\n## Q\u0026A\n\n### Could I use this action on multiple repositories with the same bucket?\n\n**Yes you can.** When storing to the bucket, this action will use\nthe following the following path:\n\n`[repository owner]/[repository name]/[cache key].tar.gz`\n\n## License\n\nThis project is [MIT licensed](LICENSE.txt).\n\n## Contributors\n\nThanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section --\u003e\n\u003c!-- prettier-ignore-start --\u003e\n\u003c!-- markdownlint-disable --\u003e\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd align=\"center\"\u003e\u003ca href=\"https://jeremylvln.fr/\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/6763873?v=4?s=100\" width=\"100px;\" alt=\"\"/\u003e\u003cbr /\u003e\u003csub\u003e\u003cb\u003eJérémy Levilain\u003c/b\u003e\u003c/sub\u003e\u003c/a\u003e\u003cbr /\u003e\u003ca href=\"https://github.com/MansaGroup/gcs-cache-action/commits?author=IamBlueSlime\" title=\"Code\"\u003e💻\u003c/a\u003e \u003ca href=\"https://github.com/MansaGroup/gcs-cache-action/commits?author=IamBlueSlime\" title=\"Documentation\"\u003e📖\u003c/a\u003e \u003ca href=\"#ideas-IamBlueSlime\" title=\"Ideas, Planning, \u0026 Feedback\"\u003e🤔\u003c/a\u003e\u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n\u003c!-- markdownlint-restore --\u003e\n\u003c!-- prettier-ignore-end --\u003e\n\n\u003c!-- ALL-CONTRIBUTORS-LIST:END --\u003e\n\nThis project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmansagroup%2Fgcs-cache-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmansagroup%2Fgcs-cache-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmansagroup%2Fgcs-cache-action/lists"}