Fix concurrent ruby future propagation without active_trace
#1429
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: Add milestone to pull requests | |
on: | |
pull_request_target: | |
types: [closed] | |
branches: | |
- master | |
jobs: | |
add_milestone_to_merged: | |
permissions: | |
# These two permissions are needed to modify milestone, even though only one should be enough | |
issues: write | |
pull-requests: write | |
if: github.event.pull_request.merged && github.event.pull_request.milestone == null | |
name: Add milestone to merged pull requests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get project milestones | |
id: milestones | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
const list = await github.rest.issues.listMilestones({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
state: 'open' | |
}) | |
// Need to manually sort because "sort by number" isn't part of the api | |
// highest number first | |
const milestones = list.data.sort((a,b) => (b.number - a.number)) | |
return milestones.length == 0 ? null : milestones[0].number | |
- name: Update Pull Request | |
if: steps.milestones.outputs.result != null | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{secrets.GITHUB_TOKEN}} | |
script: | | |
// Confusingly, the issues api is used because pull requests are issues | |
await github.rest.issues.update({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: ${{ github.event.pull_request.number }}, | |
milestone: ${{ steps.milestones.outputs.result }}, | |
}); |