{"id":18936866,"url":"https://github.com/moustacheful/github-api-exec-action","last_synced_at":"2026-04-12T18:40:39.956Z","repository":{"id":46910894,"uuid":"238370231","full_name":"moustacheful/github-api-exec-action","owner":"moustacheful","description":"Execute arbitrary commands on Github's API using Github Actions","archived":false,"fork":false,"pushed_at":"2023-03-03T12:37:22.000Z","size":1563,"stargazers_count":2,"open_issues_count":17,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-16T09:26:54.590Z","etag":null,"topics":["actions","automation","github","github-api","json","utility"],"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/moustacheful.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":"2020-02-05T04:48:30.000Z","updated_at":"2023-11-30T15:05:04.000Z","dependencies_parsed_at":"2024-10-25T05:28:58.958Z","dependency_job_id":"d3355023-7d81-48f7-800f-c75fadc3d6b7","html_url":"https://github.com/moustacheful/github-api-exec-action","commit_stats":{"total_commits":10,"total_committers":3,"mean_commits":"3.3333333333333335","dds":"0.19999999999999996","last_synced_commit":"64475e9ca1ff3bc1bee909424db77e3cb1814abc"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":"actions/typescript-action","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moustacheful%2Fgithub-api-exec-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moustacheful%2Fgithub-api-exec-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moustacheful%2Fgithub-api-exec-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/moustacheful%2Fgithub-api-exec-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/moustacheful","download_url":"https://codeload.github.com/moustacheful/github-api-exec-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":239774331,"owners_count":19694700,"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","automation","github","github-api","json","utility"],"created_at":"2024-11-08T12:09:06.831Z","updated_at":"2026-03-21T08:30:13.987Z","avatar_url":"https://github.com/moustacheful.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Github API exec action\n\nThis action executes arbitrary commands on Github's API, using octokit, such as creating pull requests.\n\nIt passes a payload to the JS Octokit library, if the command doesn't exist, it will fail. Other than that, it _should_ let you to do whatever you need with the GitHub API without having to create a new action.\n\n**Disclaimer**: I'm not responsible if you nuke your whole repository/account/existence. Be responsible and create a scoped PAT that can only do what you need it to do!\n\nIf you do use `secrets.GITHUB_TOKEN` keep in mind the breadth of the [permissions given to this token](https://help.github.com/en/actions/automating-your-workflow-with-github-actions/authenticating-with-the-github_token#about-the-github_token-secret).\n\n#### Why?\n\nNeeded a quick way to execute GitHub's API commands, and GitHub's CLI doesn't seem to provide all possible commands (i.e. creating a PR, adding labels,etc.). This might work best for \"prototyping\" purposes, for which you can later create a proper action.\n\n### Usage\n\nCreating a pull request and get the PR# (see [inputs](#Inputs) and [outputs](#Outputs) for more details):\n\n```yml\njobs:\n  create-pr:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: moustacheful/github-api-exec-action@v0\n        with:\n          # This will add the repo name and owner to the payload\n          withRepo: true\n          # See https://octokit.github.io/rest.js/ for available commands\n          command: pulls.create \n          # You can use interpolation here!\n          payload: \u003e \n            {\n              \"title\": \"Test PR by ${{ github.actor }}\",\n              \"head\": \"feature/some-feature\",\n              \"base\": \"master\"\n            }\n          # The path of the result, this uses dot notation to access the data, \n          # If you want the whole response, don't include this.\n          resultPath: 'number' \n        env:\n          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n```\n\n### Inputs\n\n##### command\n\nA string representing the command to execute based on Octokits' methods. Available commands should be the same as found in [Octokit's documentation](https://octokit.github.io/rest.js/).\n\nFor instance, if the example lists this code:\n```js\noctokit.gists.createComment({\n  //...\n})\n```\nThe command would be `gists.createComment`.\n\n##### payload\n\nA string with a JSON representing the payload to be sent to that command. This is **optional**, and defaults to an empty object. Using the example below:\n\n```js\noctokit.gists.createComment({\n  gist_id,\n  body\n})\n```\n\nThe object inside is what we should add here, again, you can find more information on what every command accepts in [Octokit's documentation](https://octokit.github.io/rest.js/). \n\n- You can use [multiline strings](https://yaml-multiline.info/) to make this more readable. Or if you prefer a compact way, wrap in single quotes, e.g.: `'{\"a\": 10}'`.\n- You can use string interpolation and all information available in contexts. \nFor instance:\n\n```yml\nsteps:\n  - uses: moustacheful/github-api-exec-action@releases/v0\n    with:\n      command: gists.createComment\n      payload: \u003e\n        { \n          \"gist_id\": 10,\n          \"body\": \"Lorem ipsum\\n Generated by ${{ github.actor }}\" \n        }\n```\n\n##### withRepo\n\nWhether or not the current repository information should be included with the payload. This adds: `owner` and `repo` to your payload. This is useful to scope calls to this specific repository.\n\n\n##### resultPath\n\nAn optional string to represent a value to extract from the API's response.\n\nFor instance, for the following structure:\n```json\n{\n  \"labels\": [\n    {\n      \"id\": 208045946,\n      \"description\": \"Something isn't working\",\n    }\n  ],\n}\n```\nWe can extract `description` by using dot notation to describe its path, in this case `labels.0.description`.\n\nIf this is not specified, the result will be the whole response.\n\n### Outputs\n\n##### result\n\nThis action should always output the `result`. The value of this output depends on the given `resultPath`.\n\nYou can later acess this data using the [steps context](thttps://help.github.com/en/actions/automating-your-workflow-with-github-actions/contexts-and-expression-syntax-for-github-actions#steps-context) to chain the output to a different action.\n\nIf you choose to work with the whole JSON for the response, you can use `jq` (which is already included in the runner context) to extract values later.\n\n### TODO:\n\n- Tests!\n- More examples/scenarios!\n- Common derived data, maybe? (e.g. PR id -- stuff that might not be immeditely available without parsing first)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoustacheful%2Fgithub-api-exec-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmoustacheful%2Fgithub-api-exec-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmoustacheful%2Fgithub-api-exec-action/lists"}