Skip to content

Permission screen

Permission screen #29

Workflow file for this run

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
});
}