Bump actions/stale from 5 to 6 #5
Workflow file for this run
This file contains 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: PR Milestone | |
on: | |
pull_request_target: | |
types: [ closed ] | |
jobs: | |
milestone: | |
if: ${{ github.event.pull_request.merged == true }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
issues: write | |
pull-requests: write | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
await github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: ${{ github.event.pull_request.number }}, | |
milestone: 42 | |
}); | |
// graphql query to get referenced issues to merged pull request | |
const query = `query($_url:URI!) { | |
resource(url:$_url) { | |
... on PullRequest { | |
closingIssuesReferences(first:10) { | |
nodes { | |
number | |
} | |
} | |
} | |
} | |
}`; | |
const variables = { | |
_url: "https://github.com/ankidroid/${{ github.event.repository.name }}/pull/${{ github.event.pull_request.number }}" | |
}; | |
const result = await github.graphql(query, variables); | |
const refIssues = result.resource.closingIssuesReferences.nodes; | |
for (issue of refIssues) { | |
console.log("Adding milestone to linked issue: ", issue.number); | |
// if issues have milestone, then it will be removed and updated with following | |
await github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: issue.number, | |
milestone: 42 | |
}); | |
} | |