chore: fix setting tracing subscriber #541
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
# Fails if a PR doesn't have a changeset and is not labeled | |
# as "no changeset needed" | |
name: Check that the PR has a changeset | |
on: | |
pull_request: | |
branches: | |
- main | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- labeled | |
- unlabeled | |
jobs: | |
check-if-changeset: | |
name: Check that PR has a changeset | |
runs-on: ubuntu-latest | |
# don't run this check in the changesets PR | |
if: github.head_ref != 'changeset-release/main' | |
steps: | |
- uses: actions/github-script@v6 | |
with: | |
script: | | |
const pullNumber = context.issue.number; | |
const { data: files } = await github.rest.pulls.listFiles({ | |
...context.issue, | |
pull_number: pullNumber | |
}); | |
const changeset = files.find( | |
file => file.status === "added" && file.filename.startsWith(".changeset/") | |
); | |
if (changeset !== undefined) { | |
console.log("Changeset found:", changeset.filename); | |
return; | |
} | |
console.log("No changeset found"); | |
const { data: pull } = await github.rest.pulls.get({ | |
...context.issue, | |
pull_number: pullNumber | |
}); | |
const noChangesetNeededLabel = pull.labels | |
.some(l => l.name === "no changeset needed"); | |
if (noChangesetNeededLabel) { | |
console.log('The PR is labeled as "no changeset needed"'); | |
return; | |
} | |
console.log('The PR is not labeled as "no changeset needed"'); | |
process.exit(1); |