build(deps-dev): Bump black from 23.7.0 to 24.3.0 #51
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: Labels pull request | |
on: | |
pull_request: | |
branches: | |
- main | |
jobs: | |
add-labels: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get the current version | |
id: get_current_version | |
run: | | |
echo "version=$(cat pyproject.toml | grep version | cut -d' ' -f3 | sed 's/"//g')" >> $GITHUB_OUTPUT | |
- name: Get the label to add | |
id: get_label | |
uses: actions/github-script@v6 | |
with: | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
script: | | |
const labels = ["release:patch", "release:minor", "release:major", "norelease"]; | |
const last_release = await github.rest.repos.getLatestRelease({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
}); | |
const last_release_tag = last_release.data.tag_name; | |
const last_release_version = last_release_tag.replace("v", ""); | |
if (last_release_version === process.env.VERSION) { | |
core.setOutput("label", labels[3]); | |
} else { | |
const last_release_version_split = last_release_version.split("."); | |
const current_version_split = process.env.VERSION.split("."); | |
if (last_release_version_split[0] !== current_version_split[0]) { | |
core.setOutput("label", labels[2]); | |
} else if (last_release_version_split[1] !== current_version_split[1]) { | |
core.setOutput("label", labels[1]); | |
} else { | |
core.setOutput("label", labels[0]); | |
} | |
} | |
env: | |
VERSION: ${{ steps.get_current_version.outputs.version }} | |
- name: Add labels | |
uses: actions-ecosystem/action-add-labels@v1 | |
with: | |
labels: ${{ steps.get_label.outputs.label }} |