Skip to content

Commit ba310c8

Browse files
authored
Check badges (#60)
1 parent 81f5eaa commit ba310c8

3 files changed

Lines changed: 43 additions & 1 deletion

File tree

.github/workflows/check-badges.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: Check badges in README.md
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
build-and-test:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- uses: actions/checkout@v3
15+
16+
- name: Check badges in README.md
17+
run: ./scripts/check-badges.bash "README.md"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Aspose.BarCode Cloud SDK for Java
22

33
[![License](https://img.shields.io/github/license/aspose-barcode-cloud/aspose-barcode-cloud-java)](LICENSE)
4-
[![Java CI with Maven](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/actions/workflows/maven.yml/badge.svg)](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/actions/workflows/maven.yml)
4+
[![Java CI with Maven](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/actions/workflows/maven.yml/badge.svg?branch=main)](https://github.com/aspose-barcode-cloud/aspose-barcode-cloud-java/actions/workflows/maven.yml)
55
[![Maven metadata URL](https://img.shields.io/maven-metadata/v?metadataUrl=https%3A%2F%2Freleases.aspose.cloud%2Fjava%2Frepo%2Fcom%2Faspose%2Faspose-barcode-cloud%2Fmaven-metadata.xml)](https://releases.aspose.cloud/java/repo/com/aspose/aspose-barcode-cloud/)
66

77
- API version: 3.0

scripts/check-badges.bash

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
readme_file=$1
5+
6+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
7+
8+
pushd "${SCRIPT_DIR}/.."
9+
10+
(grep -oP '[^/]+\.yml(?=/badge.svg)' "${readme_file}" || (echo "No badges in ${readme_file}" ; exit 1)) | while read -r workflow_file; do
11+
path_to_workflow=".github/workflows/${workflow_file}"
12+
if [ ! -e "${path_to_workflow}" ]
13+
then
14+
echo "Error, workflow does not exist \"${path_to_workflow}\""
15+
exit 1
16+
fi
17+
done
18+
19+
(grep -oP '[^/]+\.yml/badge.svg(?!\?branch=main)' "${readme_file}" || echo ) | while read -r badge_without_branch; do
20+
if [ -z "${badge_without_branch}" ]; then continue; fi
21+
echo "Badge without branch \"${badge_without_branch}\""
22+
exit 1
23+
done
24+
25+
popd

0 commit comments

Comments
 (0)