瀏覽代碼

Update "generate-repo-stub-readme.sh" to include "GitHub CI"

Tianon Gravi 5 年之前
父節點
當前提交
757694b39a
共有 1 個文件被更改,包括 13 次插入11 次删除
  1. 13 11
      generate-repo-stub-readme.sh

+ 13 - 11
generate-repo-stub-readme.sh

@@ -1,9 +1,9 @@
-#!/bin/bash
-set -e
+#!/usr/bin/env bash
+set -Eeuo pipefail
 
 
 cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
 cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
 
 
-repo="$1"
+repo="${1:-}"
 
 
 if [ -z "$repo" ]; then
 if [ -z "$repo" ]; then
 	echo >&2 'error: no repo specified'
 	echo >&2 'error: no repo specified'
@@ -24,11 +24,11 @@ if [ -s "$repo/github-repo" ]; then
 	canonicalRepo="$(< "$repo/github-repo")"
 	canonicalRepo="$(< "$repo/github-repo")"
 fi
 fi
 canonicalRepo="$(curl -fsSLI -o /dev/null -w '%{url_effective}\n' "$canonicalRepo")" # follow redirects (http://stackoverflow.com/a/3077316/433558)
 canonicalRepo="$(curl -fsSLI -o /dev/null -w '%{url_effective}\n' "$canonicalRepo")" # follow redirects (http://stackoverflow.com/a/3077316/433558)
-travisRepo="${canonicalRepo#*://github.com/}"
+githubRepoName="${canonicalRepo#*://github.com/}"
 
 
-if [[ "$travisRepo" = elastic/* ]]; then
+if [[ "$githubRepoName" = elastic/* ]]; then
 	# Elastic points "github-repo" at their upstream elastic/xyz-docker repos, but we want our README stubs to still point at our integration repos
 	# Elastic points "github-repo" at their upstream elastic/xyz-docker repos, but we want our README stubs to still point at our integration repos
-	travisRepo="docker-library/$repo"
+	githubRepoName="docker-library/$repo"
 fi
 fi
 
 
 maintainer="$(sed -e 's!%%GITHUB-REPO%%!'"$canonicalRepo"'!g' "$repo/maintainer.md")"
 maintainer="$(sed -e 's!%%GITHUB-REPO%%!'"$canonicalRepo"'!g' "$repo/maintainer.md")"
@@ -61,10 +61,12 @@ badges=()
 n=$'\n'
 n=$'\n'
 t=$'\t'
 t=$'\t'
 
 
+branch='master'
 toTest=(
 toTest=(
-	"https://img.shields.io/travis/$travisRepo/master.svg?label=Travis%20CI" "https://travis-ci.org/$travisRepo/branches"
-	"https://img.shields.io/appveyor/ci/$travisRepo/master.svg?label=AppVeyor" "https://ci.appveyor.com/project/$travisRepo"
-	"https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/$repo.svg?label=Automated%20update.sh" "https://doi-janky.infosiftr.net/job/update.sh/job/$repo"
+	"https://img.shields.io/github/workflow/status/$githubRepoName/GitHub%20CI/$branch?label=GitHub%20CI" "https://github.com/$githubRepoName/actions?query=workflow%3A%22GitHub+CI%22+branch%3A$branch"
+	"https://img.shields.io/travis/$githubRepoName/$branch.svg?label=Travis%20CI" "https://travis-ci.org/$githubRepoName/branches"
+	"https://img.shields.io/appveyor/ci/$githubRepoName/$branch.svg?label=AppVeyor" "https://ci.appveyor.com/project/$githubRepoName"
+	"https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/update.sh/job/$repo.svg?label=Automated%20update.sh" "https://doi-janky.infosiftr.net/job/update.sh/job/$repo/"
 )
 )
 
 
 _check_shields_io_image() {
 _check_shields_io_image() {
@@ -91,7 +93,7 @@ if [ -n "$arches" ]; then
 			for jenkinsJob in "job/put-shared/job/light/job/$repo" 'job/put-shared/job/heavy'; do
 			for jenkinsJob in "job/put-shared/job/light/job/$repo" 'job/put-shared/job/heavy'; do
 				jenkinsImage="https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/$jenkinsJob.svg?label=$arch"
 				jenkinsImage="https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/$jenkinsJob.svg?label=$arch"
 				if _check_shields_io_image "$jenkinsImage"; then
 				if _check_shields_io_image "$jenkinsImage"; then
-					jenkinsLink="https://doi-janky.infosiftr.net/$jenkinsJob"
+					jenkinsLink="https://doi-janky.infosiftr.net/$jenkinsJob/"
 					break
 					break
 				fi
 				fi
 			done
 			done
@@ -99,7 +101,7 @@ if [ -n "$arches" ]; then
 				continue
 				continue
 			fi
 			fi
 		else
 		else
-			jenkinsLink="https://doi-janky.infosiftr.net/job/multiarch/job/$arch/job/$repo"
+			jenkinsLink="https://doi-janky.infosiftr.net/job/multiarch/job/$arch/job/$repo/"
 			jenkinsImage="https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/$arch/job/$repo.svg?label=$arch"
 			jenkinsImage="https://img.shields.io/jenkins/s/https/doi-janky.infosiftr.net/job/multiarch/job/$arch/job/$repo.svg?label=$arch"
 		fi
 		fi
 		if _check_shields_io_image "$jenkinsImage"; then
 		if _check_shields_io_image "$jenkinsImage"; then