refactor(es/minifier): Remove useless helpers #757
Workflow file for this run
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: "Reset milestone to Planned" | |
| on: | |
| issues: | |
| types: [closed] | |
| pull_request_target: | |
| types: [closed] | |
| permissions: {} | |
| jobs: | |
| reset-milestone: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| issues: write | |
| pull-requests: write | |
| # Only completed issues and merged pull requests represent completed work. | |
| if: >- | |
| github.repository_owner == 'swc-project' && | |
| ((github.event_name == 'issues' && | |
| github.event.issue.state_reason == 'completed') || | |
| (github.event_name == 'pull_request_target' && | |
| github.event.pull_request.merged == true)) | |
| steps: | |
| - name: Set milestone to Planned | |
| env: | |
| GH_TOKEN: ${{ github.token }} | |
| EVENT_NAME: ${{ github.event_name }} | |
| ISSUE_NUMBER: ${{ github.event.issue.number }} | |
| PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }} | |
| REPOSITORY: ${{ github.repository }} | |
| run: | | |
| set -euo pipefail | |
| # This workflow does not check out or execute pull request code. It | |
| # only patches the closed PR's issue record so fork PR closures retain | |
| # the milestone automation. | |
| if [ "${EVENT_NAME}" = "issues" ]; then | |
| ITEM_NUMBER="${ISSUE_NUMBER}" | |
| ITEM_TYPE="issue" | |
| elif [ "${EVENT_NAME}" = "pull_request_target" ]; then | |
| ITEM_NUMBER="${PULL_REQUEST_NUMBER}" | |
| ITEM_TYPE="pull request" | |
| else | |
| echo "Unsupported event: ${EVENT_NAME}" | |
| exit 1 | |
| fi | |
| echo "Processing closed ${ITEM_TYPE} #${ITEM_NUMBER}" | |
| PLANNED_MILESTONE_NUMBER="$(gh api \ | |
| --method GET \ | |
| --paginate \ | |
| "/repos/${REPOSITORY}/milestones?state=open&per_page=100" \ | |
| --jq '.[] | select(.title == "Planned") | .number' \ | |
| | head -n 1 || true)" | |
| if [ -z "${PLANNED_MILESTONE_NUMBER}" ]; then | |
| echo '"Planned" milestone does not exist. Creating it.' | |
| gh api \ | |
| --method POST \ | |
| "/repos/${REPOSITORY}/milestones" \ | |
| -f title='Planned' >/dev/null || true | |
| PLANNED_MILESTONE_NUMBER="$(gh api \ | |
| --method GET \ | |
| --paginate \ | |
| "/repos/${REPOSITORY}/milestones?state=open&per_page=100" \ | |
| --jq '.[] | select(.title == "Planned") | .number' \ | |
| | head -n 1 || true)" | |
| if [ -z "${PLANNED_MILESTONE_NUMBER}" ]; then | |
| echo 'Failed to find or create "Planned" milestone' | |
| exit 1 | |
| fi | |
| echo "Using Planned milestone #${PLANNED_MILESTONE_NUMBER}" | |
| else | |
| echo "Found Planned milestone #${PLANNED_MILESTONE_NUMBER}" | |
| fi | |
| gh api \ | |
| --method PATCH \ | |
| "/repos/${REPOSITORY}/issues/${ITEM_NUMBER}" \ | |
| -f milestone="${PLANNED_MILESTONE_NUMBER}" >/dev/null | |
| echo "Updated #${ITEM_NUMBER} milestone to Planned" |