Skip to content

fix(ci_visibility): use default tracer in CI Visibility (#9328) [backport 2.9] #5589

fix(ci_visibility): use default tracer in CI Visibility (#9328) [backport 2.9]

fix(ci_visibility): use default tracer in CI Visibility (#9328) [backport 2.9] #5589

name: Add milestone to pull requests
on:
# Only run when a PR is closed
pull_request:
types:
- closed
jobs:
add_milestone_to_pr:
# Only run if the PR was closed due to a merge
if: github.event.pull_request.merged == true
name: Add milestone to merged pull requests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
# Include all history and tags
with:
fetch-depth: 0
- uses: actions/setup-python@v4
name: Install Python
with:
python-version: '3.8'
- name: Get target milestone
id: milestones
run: |
pip install -U pip
pip install packaging
scripts/get-target-milestone.py
- name: Update Pull Request
if: steps.milestones.outputs.milestone != null
uses: actions/github-script@v6.4.1
with:
github-token: ${{secrets.GITHUB_TOKEN}}
script: |
const title = "${{ steps.milestones.outputs.milestone }}";
const milestones = await github.rest.issues.listMilestones({
owner: context.repo.owner,
repo: context.repo.repo,
state: "open",
});
let milestone = milestones.data.find( (m) => m.title == title );
if (milestone === undefined) {
milestone = await github.rest.issues.createMilestone({
owner: context.repo.owner,
repo: context.repo.repo,
title: title,
});
}
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: ${{ github.event.pull_request.number }},
milestone: milestone.number,
});