Refreeze Dockerfile's requirements.txt #37
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
# This is a GitHub workflow defining a set of jobs with a set of steps. | |
# ref: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions | |
# | |
name: Refreeze Dockerfile's requirements.txt | |
on: | |
push: | |
paths: | |
- "**/requirements.in" | |
- ".github/workflows/refreeze-dockerfile-requirements-txt.yaml" | |
branches: ["main"] | |
schedule: | |
# Run 05:00 the first day of the month ref: https://crontab.guru/#0_5_1_*_* | |
- cron: "0 5 1 * *" | |
workflow_dispatch: | |
jobs: | |
refreeze-dockerfile-requirements-txt: | |
name: Refreeze Dockerfile's requirements.txt | |
# Don't run this job on forks | |
if: github.repository == 'jupyterhub/docker-image-cleaner' | |
runs-on: ubuntu-latest | |
# environment and permissions for the secrets.jupyterhub_bot_pat token was | |
# setup according to steps in: | |
# https://github.com/jupyterhub/team-compass/issues/516#issuecomment-1129961954 | |
# | |
environment: refreeze-dockerfile-requirements-txt | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Refreeze Dockerfile's requirements.txt based on requirements.in | |
run: | | |
docker run --rm \ | |
--env=CUSTOM_COMPILE_COMMAND='Use "Run workflow" button at https://github.com/jupyterhub/docker-image-cleaner/actions/workflows/refreeze-dockerfile-requirements-txt.yaml' \ | |
--volume=$PWD:/io \ | |
--workdir=/io \ | |
--user=root \ | |
python:3.11-alpine \ | |
sh -c 'pip install pip-tools==6.* && pip-compile --upgrade' | |
- name: git diff | |
run: git --no-pager diff --color=always | |
# ref: https://github.com/peter-evans/create-pull-request | |
- name: Create a PR | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: "${{ secrets.jupyterhub_bot_pat }}" | |
author: JupyterHub Bot Account <[email protected]> | |
committer: JupyterHub Bot Account <[email protected]> | |
branch: update-image-requirements | |
labels: dependencies | |
commit-message: Refreeze Dockerfile's requirements.txt | |
title: Refreeze Dockerfile's requirements.txt | |
body: >- | |
Dockerfile's requirements.txt has been refrozen based on | |
requirements.in. |