{"id":22284954,"url":"https://github.com/tomoasleep/googleapis-script","last_synced_at":"2026-04-28T23:32:23.367Z","repository":{"id":37797588,"uuid":"347818792","full_name":"tomoasleep/googleapis-script","owner":"tomoasleep","description":"Experimental: Write workflows scripting the Google APIs in JavaScript","archived":false,"fork":false,"pushed_at":"2022-12-27T16:03:15.000Z","size":1578,"stargazers_count":0,"open_issues_count":5,"forks_count":0,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-01-30T17:48:36.568Z","etag":null,"topics":["actions","google-api"],"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/tomoasleep.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":"2021-03-15T03:00:35.000Z","updated_at":"2021-03-17T04:54:01.000Z","dependencies_parsed_at":"2023-01-31T04:45:49.180Z","dependency_job_id":null,"html_url":"https://github.com/tomoasleep/googleapis-script","commit_stats":{"total_commits":6,"total_committers":1,"mean_commits":6.0,"dds":0.0,"last_synced_commit":"4430e0cbf695c6882668462597afa3ee21eed201"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomoasleep%2Fgoogleapis-script","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomoasleep%2Fgoogleapis-script/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomoasleep%2Fgoogleapis-script/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tomoasleep%2Fgoogleapis-script/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tomoasleep","download_url":"https://codeload.github.com/tomoasleep/googleapis-script/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245535516,"owners_count":20631298,"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","google-api"],"created_at":"2024-12-03T16:50:26.326Z","updated_at":"2026-04-28T23:32:18.348Z","avatar_url":"https://github.com/tomoasleep.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# googleapis-script\n\nThis action makes it easy to quickly write a script in your workflow that uses Google APIs.\nThis action is inspired by [actions/github-script](https://github.com/actions/github-script).\n\n:warning: This action is still a bit of an experiment. The API and functionality may change.\n## Usage\n\nIn order to use this action, a `script` input is provided. The value of that input should be the body of an asynchronous function call. The following arguments will be provided:\n\n* `google` A pre-autenticated [googleapis/google-api-nodejs-client](https://github.com/googleapis/google-api-nodejs-client) client.\n* `core` A reference to the [@actions/io](https://github.com/actions/toolkit/tree/main/packages/core) package.\n\nSee [googleapis/google-api-nodejs-client](https://github.com/googleapis/google-api-nodejs-client) for the API client documentation.\n\n### Authentication\n\nIn order to authenticate Google APIs these inputs are provided:\n\n* `scopes-json`: A JSON array of Google API resources and operations to be authenticated.\n  * :memo: See https://developers.google.com/identity/protocols/oauth2/scopes for the available scopes.\n* credential inputs (For now, Only service account credentials is supported.):\n  * `service-account-credentials-json`: A JSON keyfile content of a service account.\n    * :memo: To generate a service account and its key. See: https://developers.google.com/identity/protocols/oauth2/service-account?hl=ja#creatinganaccount.\n\nBefore using Google APIs, you must be sure the API to use has been enabled.\nFor more details, See: https://github.com/googleapis/google-auth-library-nodejs#application-default-credentials.\n\n### Example\n\n#### Create a document from a template document\n\nThis example creates a new document and merge contents to it like the practice in https://developers.google.com/docs/api/how-tos/merge.\n\n```yaml\n- uses: tomoasleep/googleapis-script@v1-alpha\n  with:\n    service-account-credentials-json: ${{ secrets.GOOGLE_APIS_CREDENTIAL_JSON }}\n    scopes-json: '[\"https://www.googleapis.com/auth/documents\", \"https://www.googleapis.com/auth/drive.file\"]'\n    script: |\n      // Create a new document from a template document.\n      const newDoc = await google.drive(\"v3\").files.copy({ fileId: \"\u003cTEMPLATE DOCUMENT ID\u003e\", supportsAllDrives: true })\n\n      // Replace placeholders in the created document.\n      const requests = [\n        {\n          replaceAllText: {\n            containsText: { text: '{{date}}', matchCase: true },\n            replaceText: new Date().toString(),\n          },\n        },\n      ]\n      const doc = await google.docs(\"v1\").documents.batchUpdate({ documentId: newDoc.data.id, resource: { requests } })\n\n      console.log(doc.data.documentId)\n      core.setOutput(\"new-document-id\", doc.data.documentId)\n```\n\n\n\n\n## Development\n\nThis action is generated from [actions/typescript-action](https://github.com/actions/typescript-action).\nSee [development.md](./development.md) for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomoasleep%2Fgoogleapis-script","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftomoasleep%2Fgoogleapis-script","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftomoasleep%2Fgoogleapis-script/lists"}