{"id":18772527,"url":"https://github.com/urcomputeringpal/github-script-ts","last_synced_at":"2025-04-13T08:31:34.463Z","repository":{"id":164976404,"uuid":"640364522","full_name":"urcomputeringpal/github-script-ts","owner":"urcomputeringpal","description":"actions/github-script with Typescript ","archived":false,"fork":false,"pushed_at":"2024-10-17T00:20:50.000Z","size":174,"stargazers_count":3,"open_issues_count":11,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-19T00:51:00.500Z","etag":null,"topics":["actions","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/urcomputeringpal.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":"2023-05-13T20:55:24.000Z","updated_at":"2024-04-24T00:48:10.000Z","dependencies_parsed_at":"2023-12-30T07:41:44.087Z","dependency_job_id":"9df2147b-6785-4f1c-b9a4-a90a28c9cc97","html_url":"https://github.com/urcomputeringpal/github-script-ts","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urcomputeringpal%2Fgithub-script-ts","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urcomputeringpal%2Fgithub-script-ts/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urcomputeringpal%2Fgithub-script-ts/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/urcomputeringpal%2Fgithub-script-ts/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/urcomputeringpal","download_url":"https://codeload.github.com/urcomputeringpal/github-script-ts/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223576489,"owners_count":17167875,"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","typescript"],"created_at":"2024-11-07T19:29:24.070Z","updated_at":"2024-11-07T19:29:24.724Z","avatar_url":"https://github.com/urcomputeringpal.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# github-script-ts\n\nA workflow wrapping https://github.com/actions/github-script with Typescript functionality.\n\n## Features\n\n-   Enables easily running Typescript functions exported from a tiny private module like the one in [`.github/`](./.github/) in Actions workflows. Caches build results automatically.\n-   Enables a local testing workflow for advanced Actions logic.\n-   Provides a superior experience to editing Javascript embedded in YAML.\n\n## Usage\n\n### Writing scripts\n\nThe [`@urcomputeringpal/github-script-ts`](https://www.npmjs.com/package/@urcomputeringpal/github-script-ts) package contains a type definition for the [arguments](https://github.com/actions/github-script#actionsgithub-script) passed to your script. Put all of these files in `.github` to create scripts of your own:\n\n#### `src/function1.ts`\n\n```typescript\nimport { GitHubScriptArguments } from \"@urcomputeringpal/github-script-ts\";\n\nexport async function function1(args: GitHubScriptArguments): Promise\u003cString\u003e {\n    // const { github, context, core } = args;\n    // const { glob, io, exec, fetch } = args;\n    // ...\n    return \"string\";\n}\n```\n\n#### `src/index.ts`\n\n```typescript\nexport { function1 } from \"./function1\";\n```\n\n#### `tsconfig.json`\n\n```json\n{\n    \"compilerOptions\": {\n        \"module\": \"commonjs\",\n        \"declaration\": true,\n        \"target\": \"es5\",\n        \"strict\": true,\n        \"outDir\": \"dist\",\n        \"esModuleInterop\": true\n    },\n    \"include\": [\"src/*.ts\"],\n    \"exclude\": [\"node_modules\", \"**/*.test.ts\"]\n}\n```\n\n#### `package.json`\n\n```json\n{\n    \"name\": \"ts-scripts\",\n    \"version\": \"0.0.1\",\n    \"private\": true,\n    \"scripts\": {\n        \"build\": \"tsc\"\n        // Build will be run as needed by this Action, don't specify it here\n        // prepare: \"\"\n    },\n    \"files\": [\"dist/**/*.d.ts\", \"dist/**/*.js\"],\n    \"main\": \"dist/index.js\",\n    \"dependencies\": {\n        \"@urcomputeringpal/github-script-ts\": \"0.0.7\"\n    },\n    \"devDependencies\": {\n        \"@types/node\": \"16.18.30\",\n        \"ts-loader\": \"9.4.2\",\n        \"typescript\": \"4.9.5\"\n    }\n}\n```\n\n### Running your script in a workflow\n\nSee [`action.yml`](./action.yml) for all accepted inputs.\n\n```yaml\n- name: Checkout repository\n  uses: actions/checkout@v3\n\n  # Perform setup if called without a 'function'. Compiles your Typescript\n  # module and caches build results with actions/cache.\n- name: Setup TypeScript scripts\n  id: github-script-ts\n  uses: urcomputeringpal/github-script-ts@v0\n  # with:\n  #     path: ./.github\n  #     build: npm run build\n  #     dist: dist\n\n  # Run function1. If it returns a value it can be used in subsequent steps\n  # by accessing the `result` output of the step like so\n  # ${{ steps.function1.outputs.result }}\n- name: Run function1\n  id: function1\n  uses: urcomputeringpal/github-script-ts@v0\n  # You can pass environment variables to your script and then\n  # read them from process.env.\n  # https://github.com/actions/github-script/#use-env-as-input\n  env:\n      FOO: bar\n  with:\n      github-token: ${{ secrets.GITHUB_TOKEN }}\n      function: function1\n      # args: \u003e\n      #   {github, context, core, exec, io, fetch}\n      # path: ./.github\n      # dist: dist\n      # result-encoding: string\n\n- name: Use function1 result\n  run: |\n      echo \"function1 result: ${{ steps.function1.outputs.result }}\"\n\n  # You can also use actions/github-script and import your module\n  # from the path specified in the `github-script-ts` step. This allows\n  # setting multiple outputs values using core.setOutput.\n- name: Run custom function using actions/github-script\n  id: custom\n  uses: actions/github-script@v6\n  # You can pass environment variables to your script and then\n  # read them from process.env.\n  # https://github.com/actions/github-script/#use-env-as-input\n  env:\n      FOO: bar\n  with:\n      github-token: ${{ secrets.GITHUB_TOKEN }}\n      result-encoding: string\n      script: |\n          const { custom } = await import(\"${{ steps.github-script-ts.outputs.module }}\");\n          return await custom({core,context});\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furcomputeringpal%2Fgithub-script-ts","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Furcomputeringpal%2Fgithub-script-ts","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Furcomputeringpal%2Fgithub-script-ts/lists"}