diff --git a/.github/workflows/update-milestone-badge.yml b/.github/workflows/update-milestone-badge.yml new file mode 100644 index 000000000..38c51dad1 --- /dev/null +++ b/.github/workflows/update-milestone-badge.yml @@ -0,0 +1,52 @@ +name: Update Milestone Badge + +on: + milestone: + types: [created, edited, closed, deleted] + schedule: + - cron: '0 6 * * *' + workflow_dispatch: + +permissions: + contents: write + +jobs: + update-badge: + runs-on: ubuntu-latest + steps: + - name: Checkout docs branch + uses: actions/checkout@v4 + with: + ref: docs + fetch-depth: 1 + + - name: Fetch nearest milestone and generate badge + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + set -euo pipefail + + # Fetch open milestones with due dates, pick the nearest one + TITLE=$(gh api repos/${{ github.repository }}/milestones \ + --jq '[.[] | select(.state == "open" and .due_on != null)] | sort_by(.due_on) | .[0].title // empty') + + if [ -z "$TITLE" ]; then + URL="https://img.shields.io/badge/Next%20Milestone-No%20milestone-lightgrey" + else + # URL-encode the title using jq, then escape dashes for shields.io + ENCODED=$(echo -n "$TITLE" | jq -sRr @uri | sed 's/-/--/g') + URL="https://img.shields.io/badge/Next%20Milestone-${ENCODED}-blue" + fi + + mkdir -p milestone + curl -sfL "$URL" -o milestone/badge.svg + echo "Badge generated for: ${TITLE:-No milestone}" + + - name: Commit and push + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add milestone/badge.svg + git diff --cached --quiet && echo "No changes" && exit 0 + git commit -m "chore: update milestone badge" + git push diff --git a/README.md b/README.md index 6091df5f8..cfb5c556a 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,7 @@ [![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) [![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) [![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) +[![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) 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.