{"id":8125091,"name":"KyMidd/ActionJenkinsCommitNotification","ecosystem":"actions","description":"I am used to tell Jenkins a commit was made","homepage":null,"licenses":"mpl-2.0","normalized_licenses":["MPL-2.0"],"repository_url":"https://github.com/KyMidd/ActionJenkinsCommitNotification","keywords_array":[],"namespace":"KyMidd","versions_count":1,"first_release_published_at":"2023-08-21T16:15:05.000Z","latest_release_published_at":"2023-08-21T16:15:05.000Z","latest_release_number":"v1","last_synced_at":"2026-04-11T15:45:22.598Z","created_at":"2023-08-21T18:08:57.115Z","updated_at":"2026-04-11T15:45:22.598Z","registry_url":"https://github.com/KyMidd/ActionJenkinsCommitNotification","install_command":null,"documentation_url":null,"metadata":{"name":"Jenkins Commit Notification","description":"I am used to tell Jenkins a commit was made","inputs":{"jenkins-server":{"description":"URL of the Jenkins server","required":true},"jenkins-username":{"description":"User name for accessing Jenkins. Store this in a secret for security","required":true},"jenkins-api-token":{"description":"API token for accessing Jenkins. Store this in a secret for security","required":true},"verbose":{"description":"true/false - turns on verbose logging","required":false,"default":"false"}},"runs":{"using":"composite","steps":[{"id":"jenkins-commit-notification","run":"\n###\n### Define parameters\n###\nurlOfJenkinsServer=\"${{ inputs.jenkins-server }}\"\npollTime=${{ inputs.poll-time }}\nverbose=${{ inputs.verbose }}\nuserName=${{ inputs.jenkins-username }}\napi_token=${{ inputs.jenkins-api-token }}\n\n\n###\n### Define functions\n###\nsendCommitNotification() {\n  # Map named variables to local vars\n  for ARGUMENT in \"$@\"; do\n    KEY=$(echo $ARGUMENT | cut -f1 -d=)\n\n    KEY_LENGTH=${#KEY}\n    VALUE=\"${ARGUMENT:$KEY_LENGTH+1}\"\n\n    export \"$KEY\"=\"$VALUE\"\n  done\n\n  ### Construct clone URL for unmodified casing\n  repo_clone_url=\"git@github.com:${GITHUB_REPOSITORY}.git\"\n\n  ### Print what's happening\n  echo \"--------------------------------------\"\n  if [[ $LOWERCASE == true ]]; then\n    echo \"Sending lowercase commit notification\" \"$repo_clone_url\"\n  else\n    echo \"Sending commit notification\" \"$repo_clone_url\"\n  fi\n\n  ### Send commit notification\n  COMMITNOTIFICATION=$(curl -I -s -X POST -u \"$userName:$api_token\" \"${urlOfJenkinsServer}/git/notifyCommit?url=${repo_clone_url}\")\n\n  ### Debug\n  if [[ $verbose == true ]]; then\n    echo \"verbose: Results of commit notification:\"\n    echo \"$COMMITNOTIFICATION\"\n    echo \"--------------------------------------\"\n  fi\n\n  ### Check if commit notification was successful\n  if [[ \"$COMMITNOTIFICATION\" == *\"200 OK\"* ]]; then\n    echo \"Commit notifications delivered successfully\"\n  else\n    # If we don't get a 200 OK, then no jobs were triggered\n    echo \"Something has gone wrong sending the commit notifications to Jenkins\"\n    echo \"Did you send the right Jenkins token?\"\n    echo \"Please feel free to re-run the job and let DevOps know something went wrong here\"\n    echo \"--------------------------------------\"\n    echo \"$COMMITNOTIFICATION\"\n    return 1\n  fi\n\n  ### Identify triggered jobs\n  jobs_triggered=$(echo \"$COMMITNOTIFICATION\" | grep -E 'Triggered' | cut -d \" \" -f 2 || true)\n  number_of_jobs_triggered=$(echo \"$jobs_triggered\" | awk NF | wc -l | sed 's/^ *//g' || true)\n\n  # If no jobs triggered, notify\n  if [[ \"$(echo \"$number_of_jobs_triggered\" | grep \"^0$\")\" ]]; then\n    # No jobs triggered\n    :\n  else\n    # If we trigger any jobs, return them\n    ALL_JOBS_TRIGGERED=\"${ALL_JOBS_TRIGGERED}\"$'\\n'\"${jobs_triggered}\"\n  fi\n\n}\n\n\n###\n### Print what's happening\n###\necho \"--------------------------------------\"\necho \"Summoning that slumbering beast, Jenkins, from Azathoth\"\necho \"Sending commit notifications\"\necho \"Jenkins server: $urlOfJenkinsServer\"\necho \"GitHub repository: $GITHUB_REPOSITORY\"\n\n\n###\n### Send commit notification, gather jobs triggered\n###\nsendCommitNotification \\\n  GITHUB_REPOSITORY=$GITHUB_REPOSITORY\n  LOWERCASE=false\n\n\n###\n### Send lower-cased commit notification, gather jobs triggered\n###\nGITHUB_REPOSITORY_LOWERCASE=$(echo $GITHUB_REPOSITORY | tr '[A-Z]' '[a-z]')\nsendCommitNotification \\\n  GITHUB_REPOSITORY=$GITHUB_REPOSITORY_LOWERCASE \\\n  LOWERCASE=true\n\n\n###\n### Gather jobs triggered (if any) and count them\n###\nALL_JOBS_TRIGGERED=\"$(echo \"$ALL_JOBS_TRIGGERED\" | awk 'NF' | sort -f | uniq || true)\"\nALL_JOBS_TRIGGERED_COUNT=$(echo \"$ALL_JOBS_TRIGGERED\" | awk NF | wc -l | sed 's/^ *//g' || true)\n\n\n###\n### If no jobs triggered, notify but exit success\n###\nif [[ \"$(echo $ALL_JOBS_TRIGGERED_COUNT | grep \"^0$\")\" ]]; then\n  echo \"--------------------------------------\"\n  echo \"However, no jobs were triggered\"\n  echo \"This likely isn't an error, but means no Jenkins jobs monitor this code path\"\n  echo \"Check your Jenkins job config!\"\n  echo \"--------------------------------------\"\n  exit 0\nelse\n  echo \"--------------------------------------\"\n  echo \"We triggered $ALL_JOBS_TRIGGERED_COUNT job(s)!\"\n  while IFS=$'\\n' read -r TRIGGERED_JOB; do\n    echo \"- $TRIGGERED_JOB\"\n  done \u003c\u003c\u003c \"$ALL_JOBS_TRIGGERED\"\n  echo '--------------------------------------'\n  exit 0\nfi\n","shell":"bash"}]},"branding":{"icon":"arrow-down-circle","color":"gray-dark"},"default_branch":"master","path":null},"repo_metadata":{"uuid":"681260401","full_name":"KyMidd/ActionJenkinsCommitNotification","owner":"KyMidd","description":null,"archived":false,"fork":false,"pushed_at":"2023-08-21T16:19:21.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2023-08-21T17:36:20.734Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/KyMidd.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-08-21T16:10:02.000Z","updated_at":"2023-08-21T17:36:22.473Z","dependencies_parsed_at":"2023-08-21T17:48:54.191Z","dependency_job_id":null,"html_url":"https://github.com/KyMidd/ActionJenkinsCommitNotification","commit_stats":null,"previous_names":["kymidd/actionjenkinscommitnotification"],"tags_count":1,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyMidd%2FActionJenkinsCommitNotification","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyMidd%2FActionJenkinsCommitNotification/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyMidd%2FActionJenkinsCommitNotification/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/KyMidd%2FActionJenkinsCommitNotification/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/KyMidd","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":154189509,"owners_count":7284913,"icon_url":"https://github.com/github.png","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"}},"repo_metadata_updated_at":"2023-08-21T18:08:57.570Z","dependent_packages_count":0,"downloads":null,"downloads_period":null,"dependent_repos_count":0,"rankings":{"downloads":null,"dependent_repos_count":42.76927019926956,"dependent_packages_count":0.0,"stargazers_count":null,"forks_count":null,"docker_downloads_count":null,"average":21.38463509963478},"purl":"pkg:githubactions/KyMidd/ActionJenkinsCommitNotification","advisories":[],"docker_usage_url":"https://docker.ecosyste.ms/usage/actions/KyMidd/ActionJenkinsCommitNotification","docker_dependents_count":null,"docker_downloads_count":null,"usage_url":"https://repos.ecosyste.ms/usage/actions/KyMidd/ActionJenkinsCommitNotification","dependent_repositories_url":"https://repos.ecosyste.ms/api/v1/usage/actions/KyMidd/ActionJenkinsCommitNotification/dependencies","status":null,"funding_links":[],"critical":null,"issue_metadata":null,"versions_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/KyMidd%2FActionJenkinsCommitNotification/versions","version_numbers_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/KyMidd%2FActionJenkinsCommitNotification/version_numbers","dependent_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/KyMidd%2FActionJenkinsCommitNotification/dependent_packages","related_packages_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/KyMidd%2FActionJenkinsCommitNotification/related_packages","codemeta_url":"https://packages.ecosyste.ms/api/v1/registries/github%20actions/packages/KyMidd%2FActionJenkinsCommitNotification/codemeta","maintainers":[]}