{"id":13911184,"url":"https://github.com/raeperd/google-drive-download-action","last_synced_at":"2025-06-28T21:40:34.747Z","repository":{"id":39326622,"uuid":"450803165","full_name":"raeperd/google-drive-download-action","owner":"raeperd","description":"Github action for download google drive files and folders","archived":false,"fork":false,"pushed_at":"2023-03-01T05:59:10.000Z","size":3849,"stargazers_count":9,"open_issues_count":12,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-14T23:09:27.744Z","etag":null,"topics":["github-actions","google-drive","nodejs","typescript"],"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/raeperd.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":"CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-22T11:53:04.000Z","updated_at":"2025-03-08T23:34:53.000Z","dependencies_parsed_at":"2024-09-15T17:22:28.934Z","dependency_job_id":null,"html_url":"https://github.com/raeperd/google-drive-download-action","commit_stats":{"total_commits":14,"total_committers":3,"mean_commits":4.666666666666667,"dds":0.2857142857142857,"last_synced_commit":"955978345028a73624130b92ce8ec17edf082634"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raeperd%2Fgoogle-drive-download-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raeperd%2Fgoogle-drive-download-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raeperd%2Fgoogle-drive-download-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/raeperd%2Fgoogle-drive-download-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/raeperd","download_url":"https://codeload.github.com/raeperd/google-drive-download-action/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248975315,"owners_count":21192210,"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":["github-actions","google-drive","nodejs","typescript"],"created_at":"2024-08-07T00:02:00.604Z","updated_at":"2025-04-14T23:09:49.332Z","avatar_url":"https://github.com/raeperd.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"# Google drive download action\n\n[![.github/workflows/test.yml](https://github.com/raeperd/google-drive-download-action/actions/workflows/test.yml/badge.svg)](https://github.com/raeperd/google-drive-download-action/actions/workflows/test.yml)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=raeperd_google-drive-download-action\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=raeperd_google-drive-download-action)\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=raeperd_google-drive-download-action\u0026metric=sqale_rating)](https://sonarcloud.io/summary/new_code?id=raeperd_google-drive-download-action)\n[![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=raeperd_google-drive-download-action\u0026metric=ncloc)](https://sonarcloud.io/summary/new_code?id=raeperd_google-drive-download-action)\n[![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=raeperd_google-drive-download-action\u0026metric=code_smells)](https://sonarcloud.io/summary/new_code?id=raeperd_google-drive-download-action)  \nGithub action for downloading google-drive files or folder using [Drives: list API](https://developers.google.com/drive/api/v3/reference/drives/list)\n\n## Usage\n\n```yaml\nruns-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v2\n      - uses: raeperd/raeperd/google-drive-download-action@v1.0\n        with:\n          clientId: ${{ secrets.CLIENT_ID }}\n          clientSecret: ${{ secrets.CLIENT_SECRET }}\n          redirectUri: ${{ secrets.REDIRECT_URI }}\n          credential_json: ${{ secrets.CREDENTIAL_JSON }}\n          q: \"'1U-2NgagKTnqkIZrML52A2SsD9HDDeDN7' in parents\"\n          path: \"./\"\n```\n\n- `clientId` (required) \n  - Client id of oauth2 client application\n- `clientSecret` (required)\n  - Client secret of oauth2 client application\n- `redirectUri` (required) \n  - Redirect uri of oauth2 client application\n- `credential_json` (required)\n  - credential.json value with refresh_token with scope `https://www.googleapis.com/auth/drive.readonly`\n- `q` (required)\n  - Query string to search for files and folders \n- `path` (optional)\n  - Path to download files default to working directory\n  - Default to `./`\n\n\n## Getting Started\nBefore we start, we need Google Drive Application Project and `credential.json`\n\n### Create Google Drive Application Project\n1. [Create a Google Cloud project](https://developers.google.com/workspace/guides/create-project)\n2. [Setup Google API Oauth2 prerequisites](https://developers.google.com/identity/protocols/oauth2/web-server#prerequisites)\n   - After creating your credentials, download the `client_secret.json` file from the API Console.\n3. [Enable the Google Drive API](https://developers.google.com/drive/api/v3/enable-drive-api)\n\n### Create `credential.json`\n- Create `credential.json` using [Node.js quickstart | Google Drive API](https://developers.google.com/drive/api/v3/quickstart/nodejs)  \n- Or you can create `credential.json` using [ts-node - npm](https://www.npmjs.com/package/ts-node)\n  1. Clone this repository, and install dependencies\n  2. Move your `client_secret.json` file into repository directory with name `oauth.keys.json`\n  3. ```shell\n     ts-node write-credential.ts\n     ```\n  \n❗❗ **NEVER INCLUDE YOUR CLIENT SECRET (`oauth.keys.json` and `credential.json`) IN VERSION CONTROL** ❗❗ \n\n### Setting up repository secret\nTo run this action, we need 4 repository secret parameter\n\n1. clientId\n2. clientSecret \n3. redirectUri \n4. credential_json\n\n- First 3 parameters can be obtained by `client_secret.json` (or `oauth.keys.json`)\n- credential_json is contents of file `credential.json` created by you\n  - This value is parsed by action, using `JSON.parse()` function. \n  - Check out [/src/input.ts](./src/input.ts) for more detail\n\n## How to debug google drive api query\nUse [debug.ts](./debug.ts) file in this repo\n\n1. Define constants `CLIENT_ID`, `CLIENT_SECRET`, `REDIRECT_URI`, `CREDENTIAL_JSON`\n2. Define constants `query` inside `main()` function\n3. Run `ts-node ./debug.ts` and checkout results\n\n❗❗ **NEVER INCLUDE YOUR CHANGES OF `debug.ts` IN VERSION CONTROL ❗❗\n\n# License \n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# Contacts\nraeperd117@gmail.com\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraeperd%2Fgoogle-drive-download-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fraeperd%2Fgoogle-drive-download-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fraeperd%2Fgoogle-drive-download-action/lists"}