the runtime your coding agents live on
Rust agentagent-orchestrationaiai-agentsclaude-codeclicodexcoding-agentsdeveloper-toolsdevtoolsmultiplexerrustterminalterminal-multiplexerterminal-uitmuxtuiworkspace-manager
ci: close implemented issues pending release
Ogulcan Celikf412d171d042
diff --git a/.github/workflows/label-next-release-issues.yml b/.github/workflows/label-next-release-issues.ymlindex 5e98b1f5c..7a27edc68 100644--- a/.github/workflows/label-next-release-issues.yml+++ b/.github/workflows/label-next-release-issues.yml@@ -1,4 +1,4 @@-name: Label next-release issues+name: Close pending-release issueson:push:@@ -9,10 +9,10 @@ permissions:issues: writeenv:- NEXT_RELEASE_LABEL: included-in-next-release+ NEXT_RELEASE_LABEL: pending-releasejobs:- label:+ close:runs-on: ubuntu-lateststeps:@@ -20,13 +20,15 @@ jobs:with:fetch-depth: 0- - name: Label issues referenced by pushed commits+ - name: Close issues referenced by pushed commitsshell: bashenv:- GH_TOKEN: ${{ github.token }}+ GH_TOKEN: ${{ secrets.KANGAL_GITHUB_TOKEN }}run: |set -euo pipefail+ echo "Using GitHub token for $(gh api user --jq .login)."+BEFORE="${{ github.event.before }}"AFTER="${{ github.sha }}"ZERO_SHA="0000000000000000000000000000000000000000"@@ -54,11 +56,25 @@ jobs:gh api -X POST "repos/${GITHUB_REPOSITORY}/labels" \-f name="$NEXT_RELEASE_LABEL" \-f color="5319E7" \- -f description="Landed on master and planned for the next release." \+ -f description="Implemented on master and pending a published release." \>/dev/null \|| gh api "repos/${GITHUB_REPOSITORY}/labels/${NEXT_RELEASE_LABEL}" >/dev/nullfi+ PENDING_COMMENT_MARKER="<!-- herdr:pending-release -->"+ PENDING_COMMENT="${PENDING_COMMENT_MARKER}"$'\n'"Implemented on master and queued for the next release. This is not available in a published Herdr release yet."++ issue_has_comment_marker() {+ local issue="$1"+ local marker="$2"+ local comments+ if ! comments="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/issues/${issue}/comments?per_page=100" --jq '.[].body')"; then+ echo "::warning::Could not read comments for issue #$issue."+ return 2+ fi+ grep -F -- "$marker" >/dev/null <<<"$comments"+ }+for issue in "${ISSUES[@]}"; doecho "Checking #$issue"if ! data="$(gh api "repos/${GITHUB_REPOSITORY}/issues/${issue}")"; then@@ -76,8 +92,31 @@ jobs:continuefi- if ! gh issue edit "$issue" --repo "$GITHUB_REPOSITORY" --add-label "$NEXT_RELEASE_LABEL"; then- echo "::warning::Could not label issue #$issue."+ HAS_NEXT_RELEASE_LABEL="$(jq -r --arg label "$NEXT_RELEASE_LABEL" 'any(.labels[].name; . == $label)' <<<"$data")"+ if [ "$HAS_NEXT_RELEASE_LABEL" != "true" ]; then+ if ! gh issue edit "$issue" --repo "$GITHUB_REPOSITORY" --add-label "$NEXT_RELEASE_LABEL"; then+ echo "::warning::Could not label issue #$issue."+ continue+ fi+ fi++ MARKER_STATUS=0+ issue_has_comment_marker "$issue" "$PENDING_COMMENT_MARKER" || MARKER_STATUS="$?"+ if [ "$MARKER_STATUS" -eq 2 ]; then+ continue+ fi+ HAS_PENDING_COMMENT="false"+ if [ "$MARKER_STATUS" -eq 0 ]; then+ HAS_PENDING_COMMENT="true"+ fi++ if [ "$HAS_PENDING_COMMENT" = "true" ]; then+ if ! gh issue close "$issue" --repo "$GITHUB_REPOSITORY" --reason completed; then+ echo "::warning::Could not close issue #$issue."+ continue+ fi+ elif ! gh issue close "$issue" --repo "$GITHUB_REPOSITORY" --reason completed --comment "$PENDING_COMMENT"; then+ echo "::warning::Could not close issue #$issue."continuefidonediff --git a/.github/workflows/release.yml b/.github/workflows/release.ymlindex 45ad76aaf..fd293529e 100644--- a/.github/workflows/release.yml+++ b/.github/workflows/release.yml@@ -144,11 +144,14 @@ jobs:- name: Close issues referenced by released commitsshell: bashenv:- GH_TOKEN: ${{ github.token }}- NEXT_RELEASE_LABEL: included-in-next-release+ GH_TOKEN: ${{ secrets.KANGAL_GITHUB_TOKEN }}+ NEXT_RELEASE_LABEL: pending-release+ LEGACY_NEXT_RELEASE_LABEL: included-in-next-releaserun: |set -euo pipefail+ echo "Using GitHub token for $(gh api user --jq .login)."+VERSION="${GITHUB_REF_NAME#v}"CURRENT_COMMIT="$(git rev-list -n 1 "$GITHUB_REF_NAME")"PREVIOUS_TAG="$(git describe --first-parent --tags --match 'v[0-9]*' --abbrev=0 "${CURRENT_COMMIT}^" 2>/dev/null || true)"@@ -171,6 +174,19 @@ jobs:fiRELEASE_URL="https://github.com/${GITHUB_REPOSITORY}/releases/tag/v${VERSION}"+ RELEASE_COMMENT_MARKER="<!-- herdr:released:v${VERSION} -->"+ RELEASE_COMMENT="${RELEASE_COMMENT_MARKER}"$'\n'"Released in [v${VERSION}](${RELEASE_URL})."++ issue_has_comment_marker() {+ local issue="$1"+ local marker="$2"+ local comments+ if ! comments="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/issues/${issue}/comments?per_page=100" --jq '.[].body')"; then+ echo "::warning::Could not read comments for issue #$issue."+ return 2+ fi+ grep -F -- "$marker" >/dev/null <<<"$comments"+ }for issue in "${ISSUES[@]}"; doecho "Checking #$issue"@@ -185,14 +201,42 @@ jobs:fiHAS_NEXT_RELEASE_LABEL="$(jq -r --arg label "$NEXT_RELEASE_LABEL" 'any(.labels[].name; . == $label)' <<<"$data")"+ HAS_LEGACY_NEXT_RELEASE_LABEL="$(jq -r --arg label "$LEGACY_NEXT_RELEASE_LABEL" 'any(.labels[].name; . == $label)' <<<"$data")"+ HAS_PENDING_RELEASE_LABEL="false"+ if [ "$HAS_NEXT_RELEASE_LABEL" = "true" ] || [ "$HAS_LEGACY_NEXT_RELEASE_LABEL" = "true" ]; then+ HAS_PENDING_RELEASE_LABEL="true"+ fi+ MARKER_STATUS=0+ issue_has_comment_marker "$issue" "$RELEASE_COMMENT_MARKER" || MARKER_STATUS="$?"+ if [ "$MARKER_STATUS" -eq 2 ]; then+ continue+ fi+ HAS_RELEASE_COMMENT="false"+ if [ "$MARKER_STATUS" -eq 0 ]; then+ HAS_RELEASE_COMMENT="true"+ fiif [ "$(jq -r '.state' <<<"$data")" = "open" ]; then- if ! gh issue close "$issue" --repo "$GITHUB_REPOSITORY" --reason completed --comment "Released in [v${VERSION}](${RELEASE_URL})."; then+ if [ "$HAS_RELEASE_COMMENT" = "true" ]; then+ if ! gh issue close "$issue" --repo "$GITHUB_REPOSITORY" --reason completed; then+ echo "::warning::Could not close issue #$issue."+ continue+ fi+ elif ! gh issue close "$issue" --repo "$GITHUB_REPOSITORY" --reason completed --comment "$RELEASE_COMMENT"; thenecho "::warning::Could not close issue #$issue."continuefi+ elif [ "$HAS_PENDING_RELEASE_LABEL" = "true" ]; then+ if [ "$HAS_RELEASE_COMMENT" != "true" ]; then+ if ! gh issue comment "$issue" --repo "$GITHUB_REPOSITORY" --body "$RELEASE_COMMENT"; then+ echo "::warning::Could not comment on issue #$issue."+ continue+ fi+ else+ echo "Skipping release comment for #$issue because it already exists."+ fielse- echo "Skipping close for #$issue because it is not open."+ echo "Skipping release comment for #$issue because it is closed and has no $NEXT_RELEASE_LABEL label."fiif [ "$HAS_NEXT_RELEASE_LABEL" = "true" ]; then@@ -201,6 +245,13 @@ jobs:continuefifi++ if [ "$HAS_LEGACY_NEXT_RELEASE_LABEL" = "true" ]; then+ if ! gh issue edit "$issue" --repo "$GITHUB_REPOSITORY" --remove-label "$LEGACY_NEXT_RELEASE_LABEL"; then+ echo "::warning::Could not remove $LEGACY_NEXT_RELEASE_LABEL from issue #$issue."+ continue+ fi+ fidoneupdate-latest-json: