Branding #61
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Require milestone on close | |
| on: | |
| issues: | |
| types: [closed] | |
| jobs: | |
| enforce-milestone: | |
| if: github.event.issue.state_reason == 'completed' && github.event.issue.milestone == null | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| steps: | |
| - name: Reopen issue and comment | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| REPO: ${{ github.repository }} | |
| run: | | |
| if jq -e '.issue.labels[]? | select(.name == "no-milestone-close-ok")' "$GITHUB_EVENT_PATH" > /dev/null; then | |
| echo "Skipping milestone enforcement due to no-milestone-close-ok label." | |
| exit 0 | |
| fi | |
| gh issue reopen "$ISSUE_NUMBER" --repo "$REPO" | |
| gh issue comment "$ISSUE_NUMBER" --repo "$REPO" --body "⚠️ Issues closed as completed must have a milestone assigned. Please assign a milestone before closing, or add label \`no-milestone-close-ok\` for an approved exception." |