Skip to content

Check Poetry Release and Update #7

Check Poetry Release and Update

Check Poetry Release and Update #7

Workflow file for this run

# This workflow checks for a new poetry release every week and auto updates the completions.
name: Check Poetry Release and Update
on:
schedule:
- cron: '0 0 * * 0' # Runs daily at midnight UTC
workflow_dispatch: # Allows manual triggering of the workflow
jobs:
update-poetry:
runs-on: ubuntu-latest
steps:
- name: Check out repository
uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: '3.x' # Use an appropriate Python version
- name: Install curl
run: sudo apt-get install -y curl
- name: Get Latest Poetry Version
id: get_latest_poetry_version
run: |
latest_version=$(curl -s https://api.github.com/repos/python-poetry/poetry/releases/latest | jq -r '.tag_name')
echo "::set-output name=version::$latest_version"
- name: Check Current Poetry Version
id: check_current_version
run: |
current_version=$(poetry --version | awk '{print $3}')
echo "::set-output name=current_version::$current_version"
- name: Compare Versions
id: compare_versions
run: |
if [ "${{ steps.get_latest_poetry_version.outputs.version }}" != "${{ steps.check_current_version.outputs.current_version }}" ]; then
echo "new_version=true" >> $GITHUB_ENV
else
echo "new_version=false" >> $GITHUB_ENV
fi
- name: Install Poetry
if: env.new_version == 'true'
run: |
curl -sSL https://install.python-poetry.org | python3 -
export PATH="$HOME/.local/bin:$PATH"
poetry --version
- name: Export Fish Completions
if: env.new_version == 'true'
run: |
poetry completions fish > completions/poetry.fish
git config --global user.name "GitHub Actions"
git config --global user.email "[email protected]"
git add completions/poetry.fish
git commit -m "Update Poetry to ${{ steps.get_latest_poetry_version.outputs.version }} and export fish completions"
git push origin HEAD:main