Skip to content

Commit ded7258

Browse files
authored
[chore]: create a milestone badge (#283)
1 parent 413cdde commit ded7258

2 files changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
name: Update Milestone Badge
2+
3+
on:
4+
milestone:
5+
types: [created, edited, closed, deleted]
6+
schedule:
7+
- cron: '0 6 * * *'
8+
workflow_dispatch:
9+
10+
permissions:
11+
contents: write
12+
13+
jobs:
14+
update-badge:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout docs branch
18+
uses: actions/checkout@v4
19+
with:
20+
ref: docs
21+
fetch-depth: 1
22+
23+
- name: Fetch nearest milestone and generate badge
24+
env:
25+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
26+
run: |
27+
set -euo pipefail
28+
29+
# Fetch open milestones with due dates, pick the nearest one
30+
TITLE=$(gh api repos/${{ github.repository }}/milestones \
31+
--jq '[.[] | select(.state == "open" and .due_on != null)] | sort_by(.due_on) | .[0].title // empty')
32+
33+
if [ -z "$TITLE" ]; then
34+
URL="https://img.shields.io/badge/Next%20Milestone-No%20milestone-lightgrey"
35+
else
36+
# URL-encode the title using jq, then escape dashes for shields.io
37+
ENCODED=$(echo -n "$TITLE" | jq -sRr @uri | sed 's/-/--/g')
38+
URL="https://img.shields.io/badge/Next%20Milestone-${ENCODED}-blue"
39+
fi
40+
41+
mkdir -p milestone
42+
curl -sfL "$URL" -o milestone/badge.svg
43+
echo "Badge generated for: ${TITLE:-No milestone}"
44+
45+
- name: Commit and push
46+
run: |
47+
git config user.name "github-actions[bot]"
48+
git config user.email "github-actions[bot]@users.noreply.github.com"
49+
git add milestone/badge.svg
50+
git diff --cached --quiet && echo "No changes" && exit 0
51+
git commit -m "chore: update milestone badge"
52+
git push

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
[![E2E Tests](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/e2e-tests.yml/badge.svg)](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/e2e-tests.yml)
1010
[![CodeQL](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/github-code-scanning/codeql/badge.svg)](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/github-code-scanning/codeql)
1111
[![Spotless](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/check-spotless.yml/badge.svg)](https://github.com/aws/aws-durable-execution-sdk-java/actions/workflows/check-spotless.yml)
12+
[![Roadmap](https://raw.githubusercontent.com/aws/aws-durable-execution-sdk-java/refs/heads/docs/milestone/badge.svg)](https://github.com/orgs/aws/projects/346/views/6)
1213

1314
Build resilient, long-running AWS Lambda functions that automatically checkpoint progress and resume after failures. Durable functions can run for up to one year while you pay only for active compute time.
1415

0 commit comments

Comments
 (0)