This repository has been archived by the owner on Nov 12, 2024. It is now read-only.
fix(deps): update tokio-prost monorepo to 0.13 #167
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: Pull request changelog | |
on: | |
pull_request_target: | |
types: [labeled, unlabeled, synchronize] | |
jobs: | |
check-changelog: | |
name: 'check changelog' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check if version label is present | |
id: labels | |
uses: actions/github-script@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const versionLabels = [ | |
'Action: no bump', | |
'Action: beta bump', | |
'Action: patch bump', | |
'Action: minor bump', | |
'Action: major bump', | |
]; | |
const { data: pullLabels } = await github.issues.listLabelsOnIssue({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
issue_number: context.payload.pull_request.number, | |
per_page: 100, | |
}); | |
const labels = pullLabels.map(label => label.name); | |
const versionLabelsPresent = labels | |
.filter(name => versionLabels.includes(name)); | |
console.log(`::debug ::${versionLabelsPresent.length} matching labels`); | |
if (versionLabelsPresent.length !== 1) { | |
throw new Error('Should have one and only one version bump label'); | |
} | |
const versionLabel = versionLabelsPresent[0]; | |
console.log(`::set-output name=versionLabel::${versionLabel}`) | |
if (versionLabel === 'Action: no bump') { | |
return; | |
} | |
- name: Fail if no changelog change when needed | |
if: | | |
steps.labels.outputs.versionLabel != 'Action: no bump' | |
&& steps.labels.outputs.versionLabel != 'Action: beta bump' | |
uses: actions/github-script@v2 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const { data: files } = await github.pulls.listFiles({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
pull_number: context.payload.pull_request.number, | |
per_page: 100, | |
}); | |
const changelogFile = 'CHANGELOG.md'; | |
const fileNotDeletedNames = files | |
.filter(file => file.status === 'added' || file.status === 'modified') | |
.map(file => file.filename); | |
if (!fileNotDeletedNames.includes(changelogFile)) { | |
throw new Error('CHANGELOG.md Unreleased section shoud have line additions when PR is not a no-release') | |
} | |