Update dependencies #134
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
--- | |
name: "Update dependencies" | |
on: # yamllint disable-line rule:truthy | |
schedule: | |
- cron: '43 16 * * 4' | |
workflow_dispatch: | |
env: | |
# https://github.com/pypa/pipenv/releases | |
PIPENV_INSTALL_VERSION: "2024.0.1" | |
CATEGORIES: "packages,dev-packages,docs" | |
jobs: | |
test: | |
name: Update dependencies | |
runs-on: windows-latest | |
steps: | |
- name: Checkout repository | |
# https://github.com/actions/checkout | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- name: Set up Python | |
# https://github.com/actions/setup-python | |
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0 | |
with: | |
python-version: '3.11' | |
cache: 'pipenv' | |
# Add Scripts directory to the path so that pipenv (and associated | |
# utilities) can be used once installed | |
- name: Add python Scripts directory to path | |
shell: cmd | |
# Code-page switch is needed to write the env file as utf-8 | |
run: | | |
chcp 65001 | |
python -c "import site; print(site.USER_SITE.replace('site-packages', 'Scripts'))" >> %GITHUB_PATH% | |
chcp 1252 | |
- name: Install pipenv | |
shell: cmd | |
run: python -m pip install --user pipenv==${{ env.PIPENV_INSTALL_VERSION }} | |
- name: Save current package version information | |
shell: bash | |
run: pipenv requirements --exclude-markers --categories ${{ env.CATEGORIES }} | sort > requirements.old | |
- name: Update dependencies | |
shell: bash | |
run: pipenv update --categories ${{ env.CATEGORIES }} | |
- name: Save new package version information | |
shell: bash | |
run: pipenv requirements --exclude-markers --categories ${{ env.CATEGORIES }} | sort > requirements.new | |
- name: Create update text | |
shell: bash | |
run: | | |
echo 'This is an automated update of the `Pipfile.lock` file.' > updates.txt | |
echo '' >> updates.txt | |
echo '```' >> updates.txt | |
diff --side-by-side --suppress-common-lines --width=60 --expand-tabs requirements.old requirements.new >> updates.txt || true | |
echo '```' >> updates.txt | |
cat updates.txt | |
echo 'UPDATES<<EOF' >> $GITHUB_ENV | |
cat updates.txt >> $GITHUB_ENV | |
echo 'EOF' >> $GITHUB_ENV | |
- name: Create PR to update lockfile | |
# https://github.com/peter-evans/create-pull-request | |
uses: peter-evans/create-pull-request@c5a7806660adbe173f04e3e038b0ccdcd758773c # v6.1.0 | |
with: | |
token: ${{ secrets.PAT_TOKEN }} | |
add-paths: | | |
Pipfile.lock | |
branch: workflow/update-dependencies | |
delete-branch: true | |
author: 'GitHub <[email protected]>' | |
commit-message: '[workflow] Update dependencies in Pipfile.lock' | |
signoff: true | |
title: '[workflow] Update dependencies in lockfiles' | |
labels: dependencies | |
body: ${{ env.UPDATES }} | |
draft: false # Set to true to to prevent automerge by Mergify |