build(deps): bump the minor-and-patch group across 1 directory with 1… #60
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: Pip-compile | ||
on: | ||
pull_request: | ||
types: | ||
- opened | ||
- reopened | ||
- synchronize | ||
paths: | ||
- requirements.txt | ||
- requirements-extras.txt | ||
workflow_dispatch: | ||
inputs: {} | ||
permissions: | ||
issues: write | ||
pull-requests: write | ||
jobs: | ||
versions-check: | ||
runs-on: ubuntu-24.04 | ||
container: | ||
image: python:3.9-alpine | ||
steps: | ||
# Need to install git before running the checkout action in a container | ||
- name: Install dependencies | ||
run: apk update && apk add --no-cache git | ||
- uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install pip-tools | ||
run: | | ||
pip install --upgrade pip | ||
pip install --no-cache-dir pip-tools | ||
- name: Run pip-compile to update requirements.txt | ||
run: | | ||
git config --global --add safe.directory "*" | ||
pip-compile --generate-hashes --output-file=requirements.txt pyproject.toml | ||
pip-compile \ | ||
--all-extras \ | ||
--allow-unsafe \ | ||
--generate-hashes \ | ||
--output-file=requirements-extras.txt \ | ||
pyproject.toml | ||
# This is how multi-line strings need to be injected into GitHub environment [1] | ||
# [1] https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions#multiline-strings | ||
{ | ||
echo 'GIT_DIFF<<EOF' | ||
git diff -p | ||
echo EOF | ||
} >> "$GITHUB_ENV" | ||
# Only comment on PRs when changes to requirements files are needed, based on: | ||
# - https://docs.github.com/en/actions/writing-workflows/choosing-when-your-workflow-runs/using-conditions-to-control-job-execution | ||
# - https://github.com/actions/github-script?tab=readme-ov-file#comment-on-an-issue | ||
# - https://github.com/actions/github-script/issues/247#issuecomment-1079839739 | ||
# - https://github.com/actions/github-script/issues/220#issuecomment-1007633429 | ||
- name: Comment on pull request | ||
uses: actions/github-script@v7 | ||
if: env.GIT_DIFF != '' | ||
env: | ||
DIFF: "Changes to requirements files are needed. If you're experiencing CI test failures, please apply the following patch and update the pull request:\n```diff\n${{ env.GIT_DIFF }}\n```" | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
script: | | ||
github.rest.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: process.env.DIFF | ||
}) |