From b2a0de70342cef1b2b27f3f139af262910466b24 Mon Sep 17 00:00:00 2001 From: Jover Date: Wed, 26 Jul 2023 15:31:15 -0700 Subject: [PATCH] notify-on-job-start/fail: replace repo_name with github_repo Using GitHub repos by org/name pair to make scripts more generalizable. This will also work really well with the `GITHUB_REPOSITORY` variable available for GitHub Action workflows. Co-authored-by: Victor Lin <13424970+victorlin@users.noreply.github.com> --- notify-on-job-fail | 4 ++-- notify-on-job-start | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/notify-on-job-fail b/notify-on-job-fail index 65aab6e..02cb6ba 100755 --- a/notify-on-job-fail +++ b/notify-on-job-fail @@ -9,7 +9,7 @@ set -euo pipefail bin="$(dirname "$0")" job_name="${1:?A job name is required as the first argument}" -repo_name="${2:?A repository name is required as the second argument}" +github_repo="${2:?A GitHub repository with owner and repository name is required as the second argument}" echo "Notifying Slack about failed ${job_name} job." message="❌ ${job_name} job has FAILED 😞 " @@ -17,7 +17,7 @@ message="❌ ${job_name} job has FAILED 😞 " if [[ -n "${AWS_BATCH_JOB_ID}" ]]; then message+="See AWS Batch job \`${AWS_BATCH_JOB_ID}\` () for error details. " elif [[ -n "${GITHUB_RUN_ID}" ]]; then - message+="See GitHub Action for error details. " + message+="See GitHub Action for error details. " fi "$bin"/notify-slack "$message" diff --git a/notify-on-job-start b/notify-on-job-start index 3b8ae65..3e44bb0 100755 --- a/notify-on-job-start +++ b/notify-on-job-start @@ -9,19 +9,19 @@ set -euo pipefail bin="$(dirname "$0")" job_name="${1:?A job name is required as the first argument}" -repo_name="${2:?A repository name is required as the second argument}" +github_repo="${2:?A GitHub repository with owner and repository name is required as the second argument}" build_dir="${3:-ingest}" echo "Notifying Slack about started ${job_name} job." message="${job_name} job has started." if [[ -n "${GITHUB_RUN_ID}" ]]; then - message+=" The job was submitted by GitHub Action ." + message+=" The job was submitted by GitHub Action ." fi if [[ -n "${AWS_BATCH_JOB_ID}" ]]; then message+=" The job was launched as AWS Batch job \`${AWS_BATCH_JOB_ID}\` ()." - message+=" Follow along in your local \`${repo_name}\` repo with: "'```'"nextstrain build --aws-batch --no-download --attach ${AWS_BATCH_JOB_ID} ${build_dir}"'```' + message+=" Follow along in your local clone of ${github_repo} with: "'```'"nextstrain build --aws-batch --no-download --attach ${AWS_BATCH_JOB_ID} ${build_dir}"'```' fi "$bin"/notify-slack "$message"