فهرست منبع

Switch from external script to embedded to fix branch drift

Tianon Gravi 5 سال پیش
والد
کامیت
752c8cde54
2فایلهای تغییر یافته به همراه5 افزوده شده و 23 حذف شده
  1. 5 1
      .github/workflows/munge-pr.yml
  2. 0 22
      .github/workflows/pr-labels.sh

+ 5 - 1
.github/workflows/munge-pr.yml

@@ -25,7 +25,11 @@ jobs:
       - id: labels
       - id: labels
         name: Gather List
         name: Gather List
         run: |
         run: |
-          labels="$(.github/workflows/pr-labels.sh)"
+          git fetch --quiet https://github.com/docker-library/official-images.git master
+          labels="$(git diff --numstat FETCH_HEAD...HEAD -- library/ | cut -d$'\t' -f3-)"
+          if [ -n "$labels" ] && newImages="$(git diff --name-only --diff-filter=A FETCH_HEAD...HEAD -- $labels && [ -n "$newImages" ]; then
+            labels+=$'\nnew-image'
+          fi
           labels="$(jq -Rsc 'rtrimstr("\n") | split("\n") | { labels: ., count: length }' <<<"$labels")"
           labels="$(jq -Rsc 'rtrimstr("\n") | split("\n") | { labels: ., count: length }' <<<"$labels")"
           jq . <<<"$labels"
           jq . <<<"$labels"
           echo "::set-output name=labels::$labels"
           echo "::set-output name=labels::$labels"

+ 0 - 22
.github/workflows/pr-labels.sh

@@ -1,22 +0,0 @@
-#!/usr/bin/env bash
-set -Eeuo pipefail
-
-git fetch --quiet https://github.com/docker-library/official-images.git master
-
-changes="$(git diff --numstat FETCH_HEAD...HEAD -- library/ | cut -d$'\t' -f3-)"
-set -- $changes
-
-if [ "$#" -eq 0 ]; then
-	echo >&2 'No library/ changes detected, skipping labels.'
-	exit
-fi
-
-if newImages="$(git diff --name-only --diff-filter=A FETCH_HEAD...HEAD -- "$@")" && [ -n "$newImages" ]; then
-	echo >&2
-	echo >&2 "NEW IMAGES: $newImages"
-	echo >&2
-	set -- "$@" 'new-image'
-fi
-
-IFS=$'\n'
-echo "$*"