Skip to content

chore!: Clean some Material code #148

chore!: Clean some Material code

chore!: Clean some Material code #148

Workflow file for this run

name: Check PR milestone
on:
pull_request_target:
types: [milestoned, demilestoned, opened, reopened]
branches:
- main
jobs:
check_milestone:
if: ${{ github.event.issue.pull_request || github.event.pull_request }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: "Check for milestone on PR"
uses: actions/github-script@v7
with:
script: |
let milestone = context.payload.pull_request.milestone;
if(context.payload.action === 'opened' || context.payload.action === 'reopened') {
if(milestone !== null) {
core.notice(`Milestone is ${milestone.title}`);
} else {
const milestones = await github.rest.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo,
state: "open"
});
for (const default_milestone of milestones.data) {
if (default_milestone.title === "next") {
core.notice(`No milestone set, setting default milestone: ${default_milestone.title}`);
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: context.issue.number,
milestone: default_milestone.number
});
return;
}
}
core.warning("Could not find default milestone named 'next'");
}
}
else {
if(milestone !== null) {
core.notice(`Milestone is ${milestone.title}`);
} else {
core.setFailed("No milestone: Please add a version milestone");
}
}