Added branch ref to Dependabot #14
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: Compile Requirements | |
on: | |
pull_request: | |
types: [opened, synchronize] | |
branches: | |
- dev | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
compile-requirements: | |
if: github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch' # Run for Dependabot PRs or manual trigger | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.head_ref }} # Checkout the branch from the pull request | |
- name: Run pip-compile in Docker | |
run: | | |
docker run --platform linux/amd64 \ | |
-v ${{ github.workspace }}:/opt/metamist \ | |
--workdir /opt/metamist \ | |
--rm python:3.11-slim bash -c " \ | |
pip install pip-tools && \ | |
echo 'Installed pip-tools!'; \ | |
echo 'Compiling from requirements.in'; \ | |
pip-compile requirements.in && \ | |
echo 'Compiling from requirements-dev.in'; \ | |
pip-compile requirements-dev.in" | |
- name: Commit updated requirements files | |
run: | | |
git config --local user.name "github-actions[bot]" | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git add requirements.txt requirements-dev.txt | |
git commit -m "Auto-compile requirements.txt and requirements-dev.txt" | |
git push | |
continue-on-error: true |