{"id":17295392,"url":"https://github.com/matheusvellone/labels-as-parameters","last_synced_at":"2025-06-20T11:10:02.876Z","repository":{"id":40700390,"uuid":"430781598","full_name":"matheusvellone/labels-as-parameters","owner":"matheusvellone","description":"Github Action to load labels as parameters","archived":false,"fork":false,"pushed_at":"2023-03-06T18:29:39.000Z","size":513,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-07-27T00:10:37.660Z","etag":null,"topics":["actions","labels","parameters"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/matheusvellone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2021-11-22T16:23:19.000Z","updated_at":"2022-01-03T14:51:55.000Z","dependencies_parsed_at":"2024-10-15T11:10:15.383Z","dependency_job_id":"945c23c9-de01-4aa7-a7ec-1745eb87c687","html_url":"https://github.com/matheusvellone/labels-as-parameters","commit_stats":{"total_commits":11,"total_committers":1,"mean_commits":11.0,"dds":0.0,"last_synced_commit":"165af673c23213da82ab03ec14f78761b4197a50"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvellone%2Flabels-as-parameters","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvellone%2Flabels-as-parameters/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvellone%2Flabels-as-parameters/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/matheusvellone%2Flabels-as-parameters/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/matheusvellone","download_url":"https://codeload.github.com/matheusvellone/labels-as-parameters/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248877998,"owners_count":21176243,"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","labels","parameters"],"created_at":"2024-10-15T11:10:11.129Z","updated_at":"2025-04-14T12:02:37.398Z","avatar_url":"https://github.com/matheusvellone.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Labels as parameters\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/actions/javascript-action/actions\"\u003e\u003cimg alt=\"javscript-action status\" src=\"https://github.com/matheusvellone/labels-as-parameters/actions/workflows/check-dist.yml/badge.svg\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\nUse this action to use your Pull Request labels as parameters in you workflow.\n\n## Usage\n\n```yml\njobs:\n  deploy:\n    name: Deploy Application\n    runs-on: ubuntu-latest\n\n    steps:\n      - name: Extract labels\n        uses: matheusvellone/labels-as-parameters@1.0.0\n        id: parameters\n        with:\n          separator: \"=\" # Optional\n          requiredParameters: environment, project # Optional\n      - name: Deploy API\n        if: ${{ contains(steps.parameters.outputs.project, 'api') }} # Be careful with this! Read below\n        run: |\n          ./deploy-api.sh --environment ${{ steps.parameters.outputs.environment }}\n      - name: Deploy Internal API\n        if: ${{ contains(steps.parameters.outputs.project, 'internal-api') }}\n        run: |\n          ./deploy-api-internal.sh --environment ${{ steps.parameters.outputs.environment }}\n```\n\nYou can also add multiple labels to the Pull Request, and both `contains` would evaluate to `true` if the Pull Request had both labels.\nJust be careful when using `contains` like in the example, because if a Pull Request had **only** one `project:*api*`-like label (like `project:internal-api`), the \"Deploy API\" would also be triggered.\n\n## Inputs\nThe action takes two optional inputs: separator and requiredParameters.\n\n### separator\nThe separator to be used to separate the key name from the value like.\nDefault value is `:`.\n\nA label `environment:production` would generate the `environment` variable with the `production` value.\n### requiredParameters\nA list required parameters, separated by `,`. If any of the required parameters is not found, the action will fail.\nDefault value is an empty list.\n\n## Limitations\nCurrently, the project cannot execute the action after the merge on a branch (`push` event on a workflow) if the Pull Request the merge strategy is `rebase` or if the message of the commit does not contain the Pull Request number.\n\nThis is because the action will not be able to retrieve Pull Request labels.\n\nA default message for merge, or squash, action on a Pull Request should work fine.\n\n## TODOs\n### Project\n- Fix \"Check dist\" workflow\n- Add test badge\n- Add coverage (+ badge)\n\n### Features\n- Parse keys with \"separator\" in the key\n- Parse values with \"separator\" in the value\n- Parse multiple labels from the same parameter and output them as an array\n- Parse multiple parameters and specify the output format: number, boolean, string. In a case where a single label is used and the output type is specified.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheusvellone%2Flabels-as-parameters","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmatheusvellone%2Flabels-as-parameters","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmatheusvellone%2Flabels-as-parameters/lists"}