{"id":26403485,"url":"https://github.com/fossamagna/gasworker","last_synced_at":"2026-02-27T10:38:30.618Z","repository":{"id":27469615,"uuid":"30948854","full_name":"fossamagna/gasworker","owner":"fossamagna","description":"GASWorker is a library for the script that requires a long run in the Google Apps Script","archived":false,"fork":false,"pushed_at":"2023-12-15T14:27:04.000Z","size":24,"stargazers_count":5,"open_issues_count":3,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-10-21T10:35:51.358Z","etag":null,"topics":["google-apps-script"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","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/fossamagna.png","metadata":{"files":{"readme":"README.ja.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2015-02-18T02:28:47.000Z","updated_at":"2025-04-24T19:47:14.000Z","dependencies_parsed_at":"2025-03-17T22:15:09.864Z","dependency_job_id":null,"html_url":"https://github.com/fossamagna/gasworker","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/fossamagna/gasworker","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fossamagna%2Fgasworker","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fossamagna%2Fgasworker/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fossamagna%2Fgasworker/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fossamagna%2Fgasworker/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fossamagna","download_url":"https://codeload.github.com/fossamagna/gasworker/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fossamagna%2Fgasworker/sbom","scorecard":{"id":407663,"data":{"date":"2025-08-11","repo":{"name":"github.com/fossamagna/gasworker","commit":"5bea6a0fde8add0dd3294bdf721bd27508da0455"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":3,"checks":[{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/23 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE.txt:0","Info: FSF or OSI recognized license: MIT License: LICENSE.txt:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-18T21:48:20.698Z","repository_id":27469615,"created_at":"2025-08-18T21:48:20.698Z","updated_at":"2025-08-18T21:48:20.698Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29891929,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T09:48:51.284Z","status":"ssl_error","status_checked_at":"2026-02-27T09:48:43.992Z","response_time":57,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["google-apps-script"],"created_at":"2025-03-17T15:33:59.254Z","updated_at":"2026-02-27T10:38:30.581Z","avatar_url":"https://github.com/fossamagna.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GASWorker [![NPM version][npm-image]][npm-url]\n\nGASWorker は Google Apps Script で長時間の実行を必要とするスクリプトのためのライブラリです。\n\n*Read this in other languages: [English](README.md), [日本語](README.ja.md).*\n\n## Description\n\nGoogle Apps Script はスクリプトの最大実行時間6分の [制限](https://developers.google.com/apps-script/guides/services/quotas#current_limitations) があります。\nGASWorker はこの制限を超えて長時間に渡ってスクリプトを実行する場合に、便利な機能を提供します。\n\nGASWorker は分割された長時間の処理を [時間ベースのトリガー](https://developers.google.com/apps-script/guides/triggers/installable#time-driven_triggers) の時間制限内に収まるように呼び出すことで、長時間に渡るスクリプトの実行を**擬似的**に実現します。\n\n長時間に渡って実行するスクリプトの処理を分割するのは GASWorker の利用者が行います。\nGASWorker その分割された処理を時間ベースのトリガーを利用して呼び出します。\n\n## Usage\n\n### Initialize\n\n```javascript\nvar gwConfig = {\n  callbackTarget: this,\n\n  doTask: function(token, userContext) {\n    var cell = userContext.sheet.getRange(token + 1, 1);\n    cell.setValue(\"doTask:\" + new Date().toLocaleString() + \"\\n\" + \"token:\" + token);\n    SpreadsheetApp.flush();\n    Utilities.sleep(10 * 1000);\n    token++;\n    return token \u003c 30 ? token : null;\n  },\n\n  getProperties: function() {\n    return PropertiesService.getScriptProperties();\n  },\n  getLock: function() {\n    return LockService.getScriptLock();\n  }\n};\n\nGASWorker.setup(gwConfig);\n```\n\n* 最初に`GASWorker.setup()` 関数を呼び出して初期化を行います。\n引数には設定オブジェクトを指定します。設定オブジェクトについては [Define configuration object](#configObject) を参照してください。\n\n* `getLock` 関数はGASWorkerにアプリケーションスクリプトの [Lock](https://developers.google.com/apps-script/reference/lock/lock) オブジェクトを提供する必要があります。\n* `getProperties` 関数はGASWorkerにアプリケーションスクリプトの [Properites](https://developers.google.com/apps-script/reference/properties/) オブジェクトを提供する必要があります。\n\n### \u003ca name=\"configObject\"\u003e Define configuration object\n\n設定オブジェクトには `GASWorker` からコールバックされる関数や\n `GASWorker` が参照する値を設定します。\n\n#### Define doTask function\n\n```javascript\ndoTask: function(token, userContext) {\n  Logger.log(\"doWork:\" + new Date().toLocaleString() + \"\\n\" + \"token:\" + token);\n  Utilities.sleep(10 * 1000);\n  token++;\n  return token \u003c 30 ? token : null;\n}\n```\n\n`doTask` には分割した処理を定義します。\n`doTask` は時間ベースのトリガーから呼び出されます。\n\n`doTask` の戻り値は、 `doTask` が次に呼び出される時の `token` 引数になります。\n`null`を返すと、 `doTask` は呼び出されなくなり、処理が終了します。\n\n引数 `token` は 最初は `GASWorker.execute()` の引数が渡されます。\nその後は、直前に呼び出された `doTask` の戻り値が渡されます。\n\n引数 `userContext` は任意の値を追加・変更・削除できるオブジェクトです。\n`userContext` オブジェクトの寿命は Google Apps Script\nプロセスを同じです。\n\n注意:`GASWorker.doTask`は6分以内に終了するようにしてください。\n\n#### Define beforeTasks function\n\n```javascript\nbeforeTasks: function(token, userContext) {\n  Logger.log(\"Hook before trigger start.\");\n}\n```\n\n`beforeTasks` 関数の定義はオプションです。\n`beforeTasks` 関数を使ってタスクの開始前のタイミングをフックできます。\n\n#### Define afterTasks function\n\n```javascript\nafterTasks: function(token, userContext) {\n  Logger.log(\"Hook before trigger end.\");\n}\n```\n\n`afterTasks` 関数の定義はオプションです。\n`afterTasks` 関数を使ってタスクの終了前のタイミングをフックできます。\n\n#### Define done function\n\n```javascript\ndone: function() {\n  Logger.log(\"done() : cancelled=\" + GASWorker.isCancelled());\n}\n```\n\n`GASWorker.execute`で開始した処理が終了すると`done`が呼び出されます。\n`done`の定義は任意です。定義しない場合は何もしません。\n\n### Start Task\n\n```javascript\nfunction start() {\n  Logger.log(\"execute() : \" + GASWorker.execute(0));\n}\n```\n\n`GASWorker.execute` 関数を呼び出すと時間ベースのトリガーをインストールします。\nインストールしたトリガーから`doTask`関数が呼び出されます。\n\n### Cancel\n\n```javascript\nfunction cancel() {\n  GASWorker.cancel();\n}\n```\n\n`GASWorker.execute`で開始した処理を途中で終了する場合、\n`GASWorker.cancel()`関数を呼び出します。\n\n## Install\n\n### npmパッケージとして使う\n\n```sh\n$ npm install gas-worker --save\n```\n\n[Browserify](http://browserify.org)、 [gasify](https://www.npmjs.com/package/gasify) と一緒に使うことをお勧めします。\n\n### ライブラリとして使う\n\nGoogle Apps Script の[ライブラリ](https://developers.google.com/apps-script/guide_libraries)として使用できます。\n\n* Project Key : MgArHDn4Cqyu5Dem4eLAklPFqzDO4jqHr\n\n## Licence\n\n[MIT](LICENCE.txt)\n\n## Author\n\n[fossamagna](https://github.com/fossamagna)\n\n[npm-image]: https://badge.fury.io/js/gasworker.svg\n[npm-url]: https://npmjs.org/package/gasworker\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffossamagna%2Fgasworker","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffossamagna%2Fgasworker","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffossamagna%2Fgasworker/lists"}