{"id":26730292,"url":"https://github.com/catglobe/save-actions-cache","last_synced_at":"2025-03-27T23:19:15.378Z","repository":{"id":284692166,"uuid":"955748054","full_name":"Catglobe/save-actions-cache","owner":"Catglobe","description":"Saves the actions cache for self-hosted actions runners","archived":false,"fork":false,"pushed_at":"2025-03-27T07:00:37.000Z","size":9,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T07:29:59.627Z","etag":null,"topics":["action-runners","actions","cache","composite-action","self-hosted","tooling"],"latest_commit_sha":null,"homepage":"","language":null,"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/Catglobe.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-03-27T06:11:50.000Z","updated_at":"2025-03-27T06:55:34.000Z","dependencies_parsed_at":"2025-03-27T07:40:16.073Z","dependency_job_id":null,"html_url":"https://github.com/Catglobe/save-actions-cache","commit_stats":null,"previous_names":["catglobe/save-actions-cache"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Catglobe%2Fsave-actions-cache","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Catglobe%2Fsave-actions-cache/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Catglobe%2Fsave-actions-cache/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Catglobe%2Fsave-actions-cache/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Catglobe","download_url":"https://codeload.github.com/Catglobe/save-actions-cache/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245938303,"owners_count":20697016,"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":["action-runners","actions","cache","composite-action","self-hosted","tooling"],"created_at":"2025-03-27T23:19:14.655Z","updated_at":"2025-03-27T23:19:15.371Z","avatar_url":"https://github.com/Catglobe.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Why?\n\nTired of waiting for the 'Set up job' step to finish? This action caches the actions cache for self-hosted runners.\n\n# How?\n\nAction runners already have the cache mechanism built-in. This action simply puts the files of the current actions script in that folder to avoid downloading it in the future.\n\n# Usage\n\n1. Give the project a star! :star:\n2. Setup your self-hosted runner to use the cache. You must set env variable `ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE` for the runner to a folder that is writeable.\n\nExample, we use `AutoscalingRunnerSet`:\n```yaml\napiVersion: actions.github.com/v1alpha1\nkind: AutoscalingRunnerSet\nmetadata:\n  labels:\n    app.kubernetes.io/component: \"autoscaling-runner-set\"\n    actions.github.com/scale-set-name: cg-linux\n    actions.github.com/scale-set-namespace: {{ .Release.Namespace }}\n    {{- include \"labels\" . | nindent 4 }}\n  name: gha-linux\n  namespace: {{ .Release.Namespace }}\nspec:\n  githubConfigSecret: github-auth\n  githubConfigUrl: 'https://github.com/Catglobe'\n  maxRunners: 6\n  minRunners: 6\n  runnerGroup: default\n  runnerScaleSetName: cg-linux\n  template:\n    spec:\n      containers:\n      - name: runner\n        image: catglobe/gha-runner-linux:205\n        env:\n        - name: NUGET_PACKAGES\n          value: \"/opt/hostedtoolcache/nuget\"\n        - name: npm_config_cache\n          value: \"/opt/hostedtoolcache/npm\"\n        - name: RUNNER_TOOL_CACHE\n          value: \"/opt/hostedtoolcache/tool\"\n        - name: ACTIONS_RUNNER_ACTION_ARCHIVE_CACHE\n          value: \"/opt/hostedtoolcache/actions\"\n        - name: REPO_CACHE\n          value: \"/opt/hostedtoolcache/repo-cache\"\n        #- name: STARTUP_DELAY_IN_SECONDS\n        #  value: \"600\"\n        volumeMounts:\n        - mountPath: /actions-runner/_work\n          name: work\n        - mountPath: /opt/hostedtoolcache\n          name: cache\n      initContainers:\n      - name: mkdir\n        image: alpine:3@sha256:a8560b36e8b8210634f77d9f7f9efd7ffa463e380b75e2e74aff4511df3ef88c\n        command:\n        - /bin/sh\n        - -c\n        - |\n          mkdir -p /opt/hostedtoolcache/repo-cache \u0026\u0026 \n          mkdir -p /opt/hostedtoolcache/tool \u0026\u0026 \n          mkdir -p /opt/hostedtoolcache/nuget \u0026\u0026 \n          mkdir -p /opt/hostedtoolcache/npm \u0026\u0026 \n          mkdir -p /opt/hostedtoolcache/actions \u0026\u0026 \n          chmod 777 /opt/hostedtoolcache \u0026\u0026 \n          chmod 777 /opt/hostedtoolcache/repo-cache \u0026\u0026 \n          chmod 777 /opt/hostedtoolcache/tool \u0026\u0026 \n          chmod 777 /opt/hostedtoolcache/nuget \u0026\u0026 \n          chmod 777 /opt/hostedtoolcache/npm \u0026\u0026 \n          chmod 777 /opt/hostedtoolcache/actions\n        volumeMounts:\n        - mountPath: /opt/hostedtoolcache\n          name: cache\n        - mountPath: /actions-runner/_work\n          name: work\n      nodeSelector:\n        kubernetes.io/os: linux\n        gha-runner: \"true\"\n      securityContext:\n        fsGroup: 121\n        fsGroupChangePolicy: \"OnRootMismatch\"\n      volumes:\n      - name: cache\n        persistentVolumeClaim:\n          claimName: github-cache-local-ssd\n      - emptyDir: {}\n        name: work\n```\n3. If you care about security, fork this repository. That prevents any attack vector from being introduced in the future.\n4. Add this to all of your actions workflows:\n```yaml\njobs:\n  MyFirstJob:\n    runs-on: cg-linux # or whatever you named your runner\n    ...\n    steps:\n    - name: Save actions cache\n      uses: catglobe/save-actions-cache@v1\n  OtherJob:\n    runs-on: cg-linux # or whatever you named your runner\n    ...\n    steps:\n    - name: Save actions cache\n      uses: catglobe/save-actions-cache@v1\n  PublicRunnerJob:\n    #No runs-on: ==\u003e don't add the step\n```\nReplace `catglobe` with your own company name or GitHub username if you made a fork.\n\nIf your `work` folder is not in `/actions-runner/_work`, you can set `actionsFolder` to your path (don't forget to append `/actions`):\n\n```yaml\n    - name: Save actions cache\n      uses: catglobe/save-actions-cache@v1\n      with:\n        actionsFolder: /my_custom_work_folder/actions\n```\n\n5. Profit! `Set up job` should take single digit seconds, not minutes.\n\n## How to check\n\nRun your job in debug mode and check the logs. You should see something like this:\n```\nDownload action repository 'actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683' (SHA:11bd71901bbe5b1630ceea73d27597364c9af683)\n##[debug]Copied action archive '/opt/hostedtoolcache/actions/actions_checkout/11bd71901bbe5b1630ceea73d27597364c9af683.tar.gz' to '/actions-runner/_work/_actions/_temp_42fdacac-a721-4309-8fce-fb5f1ecef8d5/c30cfe66-109b-46ed-b245-25a6f6f36b8a.tar.gz'\n##[debug]Unwrap 'actions-checkout-11bd719' to '/actions-runner/_work/_actions/actions/checkout/11bd71901bbe5b1630ceea73d27597364c9af683'\n##[debug]Archive '/actions-runner/_work/_actions/_temp_42fdacac-a721-4309-8fce-fb5f1ecef8d5/c30cfe66-109b-46ed-b245-25a6f6f36b8a.tar.gz' has been unzipped into '/actions-runner/_work/_actions/actions/checkout/11bd71901bbe5b1630ceea73d27597364c9af683'.\n```\n\n# License\n\nMIT","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatglobe%2Fsave-actions-cache","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcatglobe%2Fsave-actions-cache","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcatglobe%2Fsave-actions-cache/lists"}