name: Check for new fmt release on: schedule: # Run daily at 06:00 UTC - cron: '0 6 * * *' workflow_dispatch: permissions: contents: read issues: write jobs: check-fmt: runs-on: ubuntu-latest steps: - name: Get latest fmt release id: latest env: GH_TOKEN: ${{ github.token }} run: | latest=$(curl -fsSL \ -H "Authorization: Bearer ${GH_TOKEN}" \ -H "Accept: application/vnd.github+json" \ https://api.github.com/repos/fmtlib/fmt/releases/latest | jq -r .tag_name) if [ -z "$latest" ] || [ "$latest" = "null" ]; then echo "::error::Failed to fetch latest fmt release tag" exit 1 fi echo "latest=$latest" >> "$GITHUB_OUTPUT" echo "Latest fmt release: $latest" - name: Check for existing issue id: existing env: GH_TOKEN: ${{ github.token }} LATEST: ${{ steps.latest.outputs.latest }} REPO: ${{ github.repository }} run: | title="New fmt release available: ${LATEST}" # Search both open and closed issues so we do not reopen / duplicate # an already-acknowledged release notification. query=$(jq -rn --arg repo "$REPO" --arg title "$title" \ '"repo:\($repo) is:issue in:title \"\($title)\""') count=$(curl -fsSL -G \ -H "Authorization: Bearer ${GH_TOKEN}" \ -H "Accept: application/vnd.github+json" \ --data-urlencode "q=${query}" \ https://api.github.com/search/issues | jq -r '.total_count') echo "Matching issues found: $count" echo "count=$count" >> "$GITHUB_OUTPUT" echo "title=$title" >> "$GITHUB_OUTPUT" - name: Create issue for new fmt release if: steps.existing.outputs.count == '0' env: GH_TOKEN: ${{ github.token }} LATEST: ${{ steps.latest.outputs.latest }} REPO: ${{ github.repository }} TITLE: ${{ steps.existing.outputs.title }} run: | body=$(cat <