Skip to content

Commit 5318057

Browse files
committed
#1: Fix tests
1 parent 4f7be37 commit 5318057

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

.github/workflows/test_action.yml

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,6 @@ jobs:
2727
failure
2828
github_token: ${{ secrets.GITHUB_TOKEN }}
2929

30-
comment-on-pr:
31-
needs: generate-badge
32-
runs-on: ubuntu-latest
33-
if: always()
34-
steps:
35-
- name: Clone wiki
36-
env:
37-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
38-
run: |
39-
git clone "https://x-access-token:${GITHUB_TOKEN}@github.com/${{ github.repository }}.wiki.git" wiki
40-
4130
- name: Update or add PR comment
4231
env:
4332
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@@ -46,16 +35,16 @@ jobs:
4635
run: |
4736
set -euo pipefail
4837
49-
PREFIX="https://github.com/${REPO}/wiki/"
5038
BADGE_DIR="wiki/${REPO}"
39+
PREFIX="https://github.com/${REPO}/${BADGE_DIR}/"
5140
5241
COMMENT=""
5342
5443
if [ -d "$BADGE_DIR" ]; then
5544
for f in "$BADGE_DIR"/*.svg; do
5645
[ -e "$f" ] || continue
5746
FILE=$(basename "$f")
58-
COMMENT+="![](${PREFIX}${FILE})\n"
47+
COMMENT+="[![](${PREFIX}${FILE})]() "
5948
done
6049
fi
6150

action.yml

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ inputs:
1515
required: true
1616
push:
1717
description: 'Whether to push to wiki repository or not'
18-
default: false
18+
default: true
1919

2020
# Define the execution logic for the action
2121
runs:
@@ -30,8 +30,9 @@ runs:
3030
shell: bash
3131
run: |
3232
set -euo pipefail
33-
readarray -t NAMES <<< "${{ inputs.names }}"
34-
readarray -t RESULTS <<< "${{ inputs.results }}"
33+
readarray -t NAMES < <(printf '%s\n' "${{ inputs.names }}" | sed '/^[[:space:]]*$/d')
34+
readarray -t RESULTS < <(printf '%s\n' "${{ inputs.results }}" | sed '/^[[:space:]]*$/d')
35+
3536
3637
[ "${#NAMES[@]}" -eq "${#RESULTS[@]}" ] || { echo "names and results lengths differ" >&2; exit 1; }
3738
@@ -44,18 +45,20 @@ runs:
4445
case "$RESULT" in
4546
success) COLOR=green ;;
4647
failure) COLOR=red ;;
47-
cancelled) COLOR=gray ;;
48-
*) COLOR=gray ;;
48+
cancelled) COLOR=blue ;;
49+
*) COLOR=blue ;;
4950
esac
5051
5152
ENCODED_NAME=$(echo "$NAME" | sed 's/-/--/g')
53+
echo "NAME: $NAME"
5254
BADGE_URL="https://img.shields.io/badge/${ENCODED_NAME}-${RESULT}-${COLOR}.svg"
55+
echo "BADGE_URL: $BADGE_URL"
5356
5457
curl -s -o "wiki/${GITHUB_REPOSITORY}/${NAME}-badge.svg" "$BADGE_URL"
5558
done
5659
5760
- name: Commit and Push to Wiki
58-
if: ${{ inputs.push }}
61+
if: ${{ inputs.push == 'true' }}
5962
shell: bash
6063
run: |
6164
cd wiki

0 commit comments

Comments
 (0)