investigate removal of the config directory. Probably the only relevant stuff is under config/samples; we could move that to example
#21
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
| # .github/workflows/inherit-milestone.yml | |
| name: Inherit Milestone from Parent Issue | |
| on: | |
| issues: | |
| types: [opened] | |
| permissions: | |
| issues: write | |
| jobs: | |
| inherit-milestone: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Inherit milestone from parent issue | |
| uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const issue = context.payload.issue; | |
| // Do not override an existing milestone | |
| if (issue.milestone) { | |
| console.log("Issue already has a milestone, skipping."); | |
| return; | |
| } | |
| // Query parent issue via GraphQL | |
| const query = ` | |
| query($owner: String!, $repo: String!, $number: Int!) { | |
| repository(owner: $owner, name: $repo) { | |
| issue(number: $number) { | |
| parent { | |
| number | |
| milestone { | |
| number | |
| title | |
| } | |
| } | |
| } | |
| } | |
| } | |
| `; | |
| let result; | |
| try { | |
| result = await github.graphql(query, { | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| number: issue.number, | |
| }); | |
| } catch (error) { | |
| console.warn( | |
| "Warning: Failed to query parent issue via GraphQL. Skipping milestone inheritance.", | |
| error | |
| ); | |
| return; | |
| } | |
| const parent = result?.repository?.issue?.parent; | |
| if (!parent) { | |
| console.log("No parent issue found, skipping."); | |
| return; | |
| } | |
| console.log(`Parent issue detected: #${parent.number}`); | |
| if (!parent.milestone) { | |
| console.log("Parent has no milestone, skipping."); | |
| return; | |
| } | |
| console.log(`Applying milestone "${parent.milestone.title}" from parent #${parent.number}`); | |
| await github.rest.issues.update({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| issue_number: issue.number, | |
| milestone: parent.milestone.number, | |
| }); | |
| console.log("Milestone inherited successfully."); |