Skip to content

Commit e27484d

Browse files
committed
create a milestone badge
1 parent 413cdde commit e27484d

2 files changed

Lines changed: 54 additions & 0 deletions

File tree

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