Release tracking (next major) #4922
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: Assign Release Conductor | |
on: | |
pull_request: | |
jobs: | |
assign-release-conductor: | |
if: github.head_ref == 'changeset-release/main' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- run: npm ci | |
- name: Fetch user from pagerduty schedule | |
id: pagerduty | |
uses: actions/github-script@v5 | |
with: | |
script: | | |
const fetch = require('node-fetch'); | |
const today = new Date().toISOString().slice(0, 10) // format: 2022-11-24 | |
const url = `https://api.pagerduty.com/schedules/P3IIVC4?since=${today}&until=${today}` | |
const response = await fetch(url, { | |
headers: { | |
'Content-Type': 'application/json', | |
'Authorization': 'Token token=${{ secrets.PAGERDUTY_API_KEY_SID }}' | |
} | |
}) | |
const data = await response.json() | |
return data.schedule.final_schedule.rendered_schedule_entries[0].user.summary | |
- run: echo ${{ steps.pagerduty.outputs.result }} is release conductor | |
- name: Add user as assignee and reviewer | |
uses: actions/github-script@v6 | |
with: | |
script: | | |
github.rest.issues.addAssignees({ | |
issue_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
assignees: [${{ steps.pagerduty.outputs.result }}] | |
}) | |
github.rest.pulls.requestReviewers({ | |
pull_number: context.issue.number, | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
reviewers: [${{ steps.pagerduty.outputs.result }}] | |
}) |