{"id":7863917,"name":"shiftEscape/auto-label-pulls","ecosystem":"actions","description":"Automated labeling for Pull Requests based on the target branch","homepage":"https://github.com/marketplace/actions/auto-label-pulls","licenses":"mit","normalized_licenses":["MIT"],"repository_url":"https://github.com/shiftEscape/auto-label-pulls","keywords_array":["auto-labeling","github-actions","open-source-management","pull-requests","utilities"],"namespace":"shiftEscape","versions_count":5,"first_release_published_at":"2023-06-28T10:11:14.000Z","latest_release_published_at":"2023-10-30T14:09:25.000Z","latest_release_number":"v1.1.0","last_synced_at":"2026-05-25T15:41:00.215Z","created_at":"2023-06-28T12:46:36.713Z","updated_at":"2026-05-25T15:41:00.215Z","registry_url":"https://github.com/shiftEscape/auto-label-pulls","install_command":null,"documentation_url":null,"metadata":{"name":"Auto Label Pulls","description":"Automated labeling for Pull Requests based on the target branch","author":"shiftEscape","branding":{"icon":"tag","color":"purple"},"inputs":{"token":{"description":"Access token with restrictive `repo` permissions","required":true},"config-path":{"description":"Path of JSON file containing branch names and their corresponding labels","required":true}},"runs":{"using":"composite","steps":[{"name":"Checkout latest code","uses":"actions/checkout@v2"},{"name":"Verify Event, Action and Author","if":"${{ github.event_name != 'pull_request' || github.event.action != 'opened' || github.actor == 'dependabot[bot]' }}","shell":"bash","run":"echo \"Event is not a 'pull request' of type 'opened' or author is 'dependabot'. Exiting the workflow.\"\nexit 0\n"},{"name":"Validate and Parse Config File","id":"validate-and-parse","shell":"bash","run":"# Start here\nCONFIGURATION_PATH=\"${{ inputs.config-path }}\"\n\n# Check if the configuration file exists\nif [ ! -f $CONFIGURATION_PATH ]; then\n  echo \"The config file '$CONFIGURATION_PATH' does not exist. Exiting the workflow.\"\n  exit 1\nfi\n\n# Try to parse the JSON file to validate if it's a correct JSON\nJSON_CONFIG=$(cat $CONFIGURATION_PATH)\nif ! echo $JSON_CONFIG | jq empty \u003e /dev/null 2\u003e\u00261; then\n  echo \"Invalid JSON format in '$CONFIGURATION_PATH'. Exiting the workflow.\"\n  exit 1\nfi\n\n# Check if the JSON is not empty\nif [ $(echo $JSON_CONFIG | jq 'length') -eq 0 ]; then\n  echo \"The JSON file '$CONFIGURATION_PATH' is empty. Exiting the workflow.\"\n  exit 1\nfi\n\n# Set the ENV\necho \"CONFIGURATION_PATH=$CONFIGURATION_PATH\" \u003e\u003e \"$GITHUB_OUTPUT\"\n"},{"name":"Verify PR Base Branch Config Match","id":"verify-base-branch","shell":"bash","run":"BASE_BRANCH=${{ github.event.pull_request.base.ref }}\nCONFIGURATION_PATH=\"${{ steps.validate-and-parse.outputs.CONFIGURATION_PATH }}\"\nJSON_CONFIG=$(cat $CONFIGURATION_PATH)\n\n# Check if the base branch is in the keys of the JSON file\nif ! echo $JSON_CONFIG | jq -e --arg key \"$BASE_BRANCH\" 'has($key)' \u003e /dev/null; then\n  echo \"Base branch '$BASE_BRANCH' not found in config file '$CONFIGURATION_PATH'\"\n  exit 1\nfi\n\n# Get the value of the key in JSON_CONFIG\nVALUE=$(echo $JSON_CONFIG | jq -r --arg key \"$BASE_BRANCH\" '.[$key]')\n\n# Set the ENV\necho \"TO_ASSIGN_LABEL=$VALUE\" \u003e\u003e \"$GITHUB_OUTPUT\"\n"},{"name":"Verify Label","id":"verify-label","shell":"bash","env":{"GH_TOKEN":"${{ inputs.token }}"},"run":"OWNER=\"${{ github.event.pull_request.head.repo.owner.login }}\"\nREPO=\"${{ github.event.pull_request.head.repo.name }}\"\nPR_NUMBER=\"${{ github.event.pull_request.number }}\"\nLABEL_NAME=\"${{ steps.verify-base-branch.outputs.TO_ASSIGN_LABEL }}\"\nENCODE_LABEL=\"$(printf \"%s\" \"$LABEL_NAME\" | jq -s -R -r @uri)\"\n\n# Check if the label name exists\nif ! gh api repos/$OWNER/$REPO/labels/$ENCODE_LABEL -f status=200 \u003e/dev/null; then\n  RANDOM_COLOR=$(openssl rand -hex 3)\n  # Add the label to the pull request\n  gh api repos/$OWNER/$REPO/labels \\\n    -X POST \\\n    -H \"Accept: application/vnd.github+json\" \\\n    -H \"X-GitHub-Api-Version: 2022-11-28\" \\\n    -f name=\"$LABEL_NAME\" \\\n    -f color=\"$RANDOM_COLOR\"\nfi\n"},{"name":"Assign Label to PR","id":"assign-label-to-pr","shell":"bash","env":{"GH_TOKEN":"${{ inputs.token }}"},"run":"PR_NUMBER=\"${{ github.event.pull_request.number }}\"\nLABEL_NAME=\"${{ steps.verify-base-branch.outputs.TO_ASSIGN_LABEL }}\"\n\n# Assign label to PR\ngh issue edit \"$PR_NUMBER\" --add-label \"$LABEL_NAME\"\n"}]},"default_branch":"main","path":null},"repo_metadata":{"uuid":"659019315","full_name":"shiftEscape/auto-label-pulls","owner":"shiftEscape","description":"⚡️ Automates the process of assigning labels to your pull requests based on the target branch","archived":false,"fork":false,"pushed_at":"2023-11-09T07:01:35.000Z","size":13,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2023-12-09T12:20:40.449Z","etag":null,"topics":["auto-labeling","github-actions","open-source-management","pull-requests","utilities"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/auto-label-pulls","language":null,"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/shiftEscape.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}},"created_at":"2023-06-27T01:47:16.000Z","updated_at":"2023-09-18T23:16:03.000Z","dependencies_parsed_at":null,"dependency_job_id":"ff2c2e4a-c6fb-482e-9cc9-1aa55ee2e013","html_url":"https://github.com/shiftEscape/auto-label-pulls","commit_stats":null,"previous_names":["shiftescape/auto-label-pulls"],"tags_count":5,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shiftEscape","download_url":"https://codeload.github.com/shiftEscape/auto-label-pulls/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":175415282,"owners_count":10257845,"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"},"owner_record":{"login":"shiftEscape","name":"Alvin Bellero","uuid":"2888535","kind":"user","description":" 🇵🇭  Software Engineer","email":"","website":null,"location":"Singapore","twitter":null,"company":null,"icon_url":"https://avatars.githubusercontent.com/u/2888535?u=56e459062938a9c82eb88774b851594dc6f2ce32\u0026v=4","repositories_count":4,"last_synced_at":"2023-03-04T10:43:44.417Z","metadata":{"has_sponsors_listing":false},"html_url":"https://github.com/shiftEscape","created_at":"2022-11-14T17:37:48.746Z","updated_at":"2023-03-04T10:43:44.422Z","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shiftEscape","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shiftEscape/repositories"},"tags":[{"name":"v.1.2.0","sha":"2be06bbfedead8020a7d2997245ba569684e4781","kind":"commit","published_at":"2023-11-09T07:00:02.000Z","download_url":"https://codeload.github.com/shiftEscape/auto-label-pulls/tar.gz/v.1.2.0","html_url":"https://github.com/shiftEscape/auto-label-pulls/releases/tag/v.1.2.0","dependencies_parsed_at":"2023-11-11T04:46:58.571Z","dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v.1.2.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v.1.2.0/manifests"},{"name":"v1.1.0","sha":"de428bdc561b79e7d842b76cbcfc52e59f2328e2","kind":"commit","published_at":"2023-10-30T14:09:25.000Z","download_url":"https://codeload.github.com/shiftEscape/auto-label-pulls/tar.gz/v1.1.0","html_url":"https://github.com/shiftEscape/auto-label-pulls/releases/tag/v1.1.0","dependencies_parsed_at":"2023-11-01T04:24:14.107Z","dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v1.1.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v1.1.0/manifests"},{"name":"v0.1.1","sha":"35234585ed6a1270a196562c2a765cbf57ecfc2a","kind":"tag","published_at":"2023-06-28T10:21:16.000Z","download_url":"https://codeload.github.com/shiftEscape/auto-label-pulls/tar.gz/v0.1.1","html_url":"https://github.com/shiftEscape/auto-label-pulls/releases/tag/v0.1.1","dependencies_parsed_at":"2023-07-03T04:09:54.595Z","dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v0.1.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v0.1.1/manifests"},{"name":"v1.0.0","sha":"35234585ed6a1270a196562c2a765cbf57ecfc2a","kind":"commit","published_at":"2023-06-28T10:18:15.000Z","download_url":"https://codeload.github.com/shiftEscape/auto-label-pulls/tar.gz/v1.0.0","html_url":"https://github.com/shiftEscape/auto-label-pulls/releases/tag/v1.0.0","dependencies_parsed_at":"2023-07-03T04:09:54.575Z","dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v1.0.0","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v1.0.0/manifests"},{"name":"v0.0.1","sha":"6e52642332ac585aff897faa8ea40bb6e270fdb2","kind":"tag","published_at":"2023-06-28T10:11:14.000Z","download_url":"https://codeload.github.com/shiftEscape/auto-label-pulls/tar.gz/v0.0.1","html_url":"https://github.com/shiftEscape/auto-label-pulls/releases/tag/v0.0.1","dependencies_parsed_at":"2023-07-03T04:09:54.577Z","dependency_job_id":null,"tag_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v0.0.1","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shiftEscape%2Fauto-label-pulls/tags/v0.0.1/manifests"}]},"repo_metadata_updated_at":"2023-12-09T12:20:52.297Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":0,"rankings":{"downloads":null,"dependent_repos_count":35.54488435907487,"dependent_packages_count":0.0,"stargazers_count":34.96014634783745,"forks_count":34.902486034432066,"docker_downloads_count":null,"average":26.351879185336095},"purl":"pkg:githubactions/shiftEscape/auto-label-pulls","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/actions/shiftEscape/auto-label-pulls","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/actions/shiftEscape/auto-label-pulls","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/actions/shiftEscape/auto-label-pulls/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":null,"versions_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/shiftEscape%2Fauto-label-pulls/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/shiftEscape%2Fauto-label-pulls/version_numbers","latest_version_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/shiftEscape%2Fauto-label-pulls/latest_version","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/shiftEscape%2Fauto-label-pulls/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/shiftEscape%2Fauto-label-pulls/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/shiftEscape%2Fauto-label-pulls/codemeta","maintainers":[]}