Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ updates:
directory: /
schedule:
interval: monthly
allow:
- dependency-type: "all"
groups:
pip:
patterns:
Expand Down
71 changes: 71 additions & 0 deletions .github/workflows/update-requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: update-requirements

on:
schedule:
- cron: "0 2 1 * *" # First day of every month at 2am.
push:
branches:
- main
paths:
- '.github/workflows/update-requirements.yml'
- 'examples/requirements.in'
- 'setup.py'
pull_request:
branches:
- main
paths:
- '.github/workflows/update-requirements.yml'
- 'examples/requirements.in'
- 'setup.py'
workflow_dispatch:

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref }}
cancel-in-progress: true

permissions: read-all

jobs:
update-requirements:
name: Test examples
runs-on: ubuntu-latest
timeout-minutes: 90
permissions:
contents: write
pull-requests: write
steps:
- name: Checkout Melting Pot
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683

- name: Install Melting Pot
uses: ./.github/actions/install

- name: Compile requirements.txt
run: pip-compile --generate-hashes --strip-extras --output-file=requirements.txt --extra=dev setup.py examples/requirements.in

- name: Check for changes
id: check_changes
run: |
if git diff --quiet; then
echo "changed=false" >> $GITHUB_OUTPUT
else
echo "changed=true" >> $GITHUB_OUTPUT
fi

- name: Create pull request
if: steps.check_changes.outputs.changed == 'true'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="update-requirements-$(date +%Y%m%d%H%M%S)"
git checkout -b "${BRANCH_NAME}"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git config --global user.name "GitHub Actions Bot"
git add requirements.txt
git commit -m "Update requirements.txt"
git push origin "$BRANCH_NAME"
gh pr create \
--base "${GITHUB_BASE_REF:-main}" \
--head "$BRANCH_NAME" \
--title "Update requirements.txt" \
--body 'Automatically generated by GitHub Action.'
6 changes: 6 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,9 @@ jobs = 'auto'
# Use the enum overlay for more precise enum checking. This flag is temporary
# and will be removed once this behavior is enabled by default.
use_enum_overlay = true

[tool.pip-tools]
generate_hashes = true
reuse_hashes = true
strip_extras = true
upgrade = true
Loading