ruff-pre-commit/.github/workflows/main.yml
Jeppe Fihl-Pearson 987f9d7d01
Remove "v" from the Ruff version number in link to release notes (#92)
## Summary

Starting with version 0.5.0 of Ruff, the release/tag name doesn't have a
leading "v". This has broken the link to the release notes that get
added to the release notes for the pre-commit hook.

This fixes it by stripping any "v" from the version number string.

See #91.

## Test Plan

Tested in a bash shell:
```bash
bash-5.2$ TAG_NAME=v0.5.0
bash-5.2$ echo ${TAG_NAME/v}
0.5.0
```

Will otherwise have to be tested on the next Ruff release.
2024-06-28 07:32:17 -04:00

64 lines
1.8 KiB
YAML

name: main
on:
schedule:
- cron: "0 */4 * * *"
workflow_dispatch:
repository_dispatch:
types: [pypi_release]
jobs:
build:
name: main
runs-on: ubuntu-latest
steps:
- if: ${{ startsWith(github.event_name, 'repository_dispatch') }}
run: sleep 30
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: download uv
run: curl -LsSf https://astral.sh/uv/install.sh | sh
- run: uv pip install --system -r requirements-dev.txt
- name: set git config
run: |
git config user.name "$GITHUB_ACTOR"
git config user.email "$GITHUB_ACTOR@users.noreply.github.com"
- run: python mirror.py
- name: check for unpushed commits
id: check_unpushed
run: |
UNPUSHED_COMMITS=$(git log origin/main..HEAD)
if [ -z "$UNPUSHED_COMMITS" ]; then
echo "No unpushed commits found."
echo "changes_exist=false" >> $GITHUB_ENV
else
echo "Unpushed commits found."
echo "changes_exist=true" >> $GITHUB_ENV
fi
- name: push changes if they exist
if: env.changes_exist == 'true'
run: |
git push origin HEAD:refs/heads/main
git push origin HEAD:refs/heads/main --tags
- name: create release on new tag if new changes exist
if: env.changes_exist == 'true'
run: |
TAG_NAME=$(git describe --tags $(git rev-list --tags --max-count=1))
echo $TAG_NAME
gh release create "$TAG_NAME" \
--title "$TAG_NAME" \
--notes "See: https://github.com/astral-sh/ruff/releases/tag/${TAG_NAME/v}" \
--latest
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}