Skip to content

Clear "Shipping Next" #2

Clear "Shipping Next"

Clear "Shipping Next" #2

name: Clear "Shipping Next"
on:
workflow_dispatch:
env:
SHIPPING_NEXT_MILESTONE_ID: 2 # ID for "Shipping Next" milestone
permissions:
pull-requests: write
issues: write
jobs:
clear_shipping_next:
name: Clear "Shipping Next" Milestone
runs-on: ubuntu-24.04-arm
steps:
- name: Get issues & PRs in "Shipping Next" milestone
id: get_issues
run: |
# Fetch issues with titles
response=$(gh api -X GET \
repos/${{ github.repository }}/issues \
-f milestone=${{ env.SHIPPING_NEXT_MILESTONE_ID }} \
-f state=all \
-f labels=released)
# Extract just the numbers for the output
issues=$(echo "$response" | jq -r '[.[].number] | join(" ")')
echo "issues=$issues" >> $GITHUB_OUTPUT
# Add step summary with titles
if [ -n "$issues" ]; then
echo "## Issues & PRs to clear from 'Shipping Next' milestone" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "$response" | jq -r '.[] | "- #\(.number) \(.title)"' >> $GITHUB_STEP_SUMMARY
else
echo "No issues or PRs found in the 'Shipping Next' milestone with the 'released' label." >> $GITHUB_STEP_SUMMARY
fi
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Clear milestone from issues & PRs
if: steps.get_issues.outputs.issues != ''
run: |
for issue_number in ${{ steps.get_issues.outputs.issues }}; do
gh api -X PATCH \
repos/${{ github.repository }}/issues/$issue_number \
-f milestone=null
done
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}