{"id":15791683,"url":"https://github.com/levonet/action-c-3po-droid","last_synced_at":"2025-07-04T02:37:24.399Z","repository":{"id":52817889,"uuid":"357347697","full_name":"levonet/action-C-3PO-droid","owner":"levonet","description":"Comment Parser GitHub Action","archived":false,"fork":false,"pushed_at":"2021-04-20T19:50:06.000Z","size":146,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-11T23:05:50.386Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/levonet.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-04-12T21:46:08.000Z","updated_at":"2021-04-20T19:50:08.000Z","dependencies_parsed_at":"2022-08-17T15:10:41.746Z","dependency_job_id":null,"html_url":"https://github.com/levonet/action-C-3PO-droid","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/levonet/action-C-3PO-droid","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Faction-C-3PO-droid","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Faction-C-3PO-droid/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Faction-C-3PO-droid/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Faction-C-3PO-droid/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/levonet","download_url":"https://codeload.github.com/levonet/action-C-3PO-droid/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/levonet%2Faction-C-3PO-droid/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263435069,"owners_count":23466074,"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":[],"created_at":"2024-10-04T23:01:16.638Z","updated_at":"2025-07-04T02:37:24.359Z","avatar_url":"https://github.com/levonet.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# GitHub Action: Comment Parser\n\n\u003e I Am C-3PO, Human/Cyborg Relations. And You Are?\n\nThe action parses comments using predefined patterns.\nIt will create the output parameters in case of a match with the pattern.\nThis action can be used to control various CI/CD processes by specifying commands in comments or descriptions of Issues or Pull Requests.\n\n## Example usage\n\n\u003e *Note:* `issue_comment` event will only trigger a workflow run if the workflow file is on the default branch.\n\n### `.github/workflow/droid.yml`\n\n```yml\nname: droid\non:\n  issue_comment:\n    types: [ created ]\njobs:\n  uses:\n    runs-on: ubuntu-latest\n    steps:\n    - uses: blablacar/action-c-3po-droid@master\n      id: c-3po\n      with:\n        expect: |\n          - pattern: ^/hello (?\u003cvalue\u003e.+)$\n          - pattern: ^/chances (?\u003coutput\u003e[^=]+)=(?\u003cvalue\u003e.*)$\n          - command: intrusion\n          - command: disappeared\n            value: R2-D2\n\n    - if: ${{ steps.c-3po.outputs.is-hello }}\n      run: echo \"${{ steps.c-3po.outputs.has-hello }}, it is you, it Is You!\"\n\n    - if: ${{ steps.c-3po.outputs.is-chances \u0026\u0026 steps.c-3po.outputs.has-chances-survival }}\n      run: echo \"R2 says the chances of survival are ${{ steps.c-3po.outputs.has-chances-survival }}... to one\"\n\n    - if: ${{ steps.c-3po.outputs.is-chances \u0026\u0026 steps.c-3po.outputs.has-chances-win \u003e 0 }}\n      run: echo \"We'll take the next chance, and the next.\"\n\n    - if: ${{ steps.c-3po.outputs.is-intrusion }}\n      run: echo \"We're doomed\"\n\n    - if: ${{ steps.c-3po.outputs.is-disappeared }}\n      run: echo \"${{ steps.c-3po.outputs.has-disappeared }}, where are you?\"\n```\n\nThen try adding comments to the Issue with the following content:\n- `/hello R2-D2`\n- `/chances survival=725`\n- `/chances win=5`\n- `/intrusion`\n- `/disappeared who?`\n\n## Inputs\n\n### `expect`\n\nA list of objects with patterns and output settings.\nThis field contains a string with a list in YAML format:\n\n```yaml\n- command: \u003ccommand name\u003e\n  pattern: \u003cregex\u003e\n  output: \u003coutput key\u003e\n  value: \u003cvalue\u003e\n```\n\nEach object must have a command or pattern parameter.\nAfter processing the first match in a row, subsequent patterns are ignored for that row.\n\n#### command\n\nOptional.\nSpecifies the command of the team to be searched for at the beginning of each new comment line.\nThe command in the comment must start with the `/` character.\nYou do not need to specify this `/` character in the `command` parameter.\nThe action returns the output parameters `is-\u003ccommand\u003e`, `has-\u003ccommand\u003e` or `has-\u003ccommand\u003e-\u003coutput key\u003e` when the command is found in the comment.\n\nExample:\n\n```yaml\n- command: hello\n```\n\nWill be a trigger for a comment:\n\n```\n/hello world\n```\n\nThe action will return the parameters:\n\n```\nsteps.\u003cid\u003e.outputs.is-hello = '/hello world'\nsteps.\u003cid\u003e.outputs.has-hello = 'world'\n```\n\n#### pattern\n\nOptional.\nSpecifies a regex pattern according to which a match will be searched for in the new comment.\nIf the command is not defined, it can be determined by the first word that begins in the pattern after `^/`.\n\nThe pattern may contain regex named capturing groups that will determine the output key, or data for the output parameters.\n- `(?\u003coutput\u003e...)` — determines the output key that is appended to the name of the output parameter `has-\u003ccommand\u003e-\u003coutput key\u003e`.\n- `(?\u003cvalue\u003e...)` - determines the data that is contained in the output parameter `has-*`.\n\nExample:\n\n```yaml\n- pattern: ^/set (?\u003coutput\u003e.+)=(?\u003cvalue\u003e.*)$\n```\n\nWill be a trigger for a comment:\n\n```\n/set hello=world\n```\n\nThe action will return the parameters:\n\n```\nsteps.\u003cid\u003e.outputs.is-set = '/set hello=world'\nsteps.\u003cid\u003e.outputs.has-set-hello = 'world'\n```\n\n#### output (experimental)\n\nOptional.\nContains the output key that is appended to the name of the output parameter `has-\u003ccommand\u003e-\u003coutput key\u003e`.\nHas a higher priority for the named capturing groups in the regex pattern.\n\n#### value (experimental)\n\nOptional.\nContains the data that is contained in the output parameter `has-*`.\nHas a higher priority for the named capturing groups in the regex pattern.\n\n### `in`\n\nOptional.\nDetermines the type of problems in the comments which will be searched for matching patterns.\nPossible values are `issue`, `pull_request` or `any`.\nThe default is `any`.\n\n### `description`\n\nOptional.\nLooks for pattern matches in the description at Issue or Pull Request creation if `true` is set.\nThe default is `false`.\n\n## Outputs\n\n### `commands`\n\nReturn a list of parsed commands.\nIn JSON format.\nList items have the optional attributes `command`, `output` and `value`.\n\n### `is-\u003ccommand\u003e`\n\nReturns the contents of a row if a pattern or command is matched.\nThis parameter is present if there is a specified command name in the `command` or `pattern` parameter.\n\n### `has-\u003ccommand\u003e`\n\nReturns the data defined by `value`, or the content in the line after the command.\nThis parameter is present if there is a specified:\n- command name in the `command` or `pattern` parameter\n- `value` in `pattern` or `value` parameter.\n\n### `has-\u003ccommand\u003e-\u003coutput key\u003e`\n\nReturns the data defined by `value`, or the content in the line after the command.\nThis parameter is present if there is a specified:\n- command name in the `command` or `pattern` parameter\n- output key in `pattern` or `output` parameter\n- `value` in `pattern` or `value` parameter.\n\n### `has-\u003coutput key\u003e`\n\nReturns the data defined by `value`, or the content in the line after the command.\nThis parameter is present if there is a specified:\n- output key in `pattern` or `output` parameter\n- `value` in `pattern` or `value` parameter.\nAlso, no command name is specified.\n\n# License\n\nThe scripts and documentation in this project are released under the [MIT License](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevonet%2Faction-c-3po-droid","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flevonet%2Faction-c-3po-droid","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flevonet%2Faction-c-3po-droid/lists"}