Skip to content

Commit

Permalink
Move generate to its own workflow and create commits
Browse files Browse the repository at this point in the history
  • Loading branch information
${GIT_USER_NAME} authored and ${GIT_USER_NAME} committed Jan 6, 2025
1 parent b76293a commit e5655b2
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 17 deletions.
55 changes: 55 additions & 0 deletions .github/workflows/generate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Run generate

on:
pull_request_target:
types:
- opened
- synchronize
- reopened
workflow_dispatch:

permissions:
contents: write # Required for merging the PR
pull-requests: write # Required for managing pull requests

jobs:
generate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
cache: pip
- name: Run generate script
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
./generate.py
- name: Commit any changes
id: commit
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
if [[ $(git status --porcelain) ]]; then
git add .
git commit -m "Automated update from generate.py"
echo "Changes committed."
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "No changes to commit."
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Push changes
if: steps.commit.outputs.changes == 'true'
run: |
git push
gh pr comment ${{ github.event.pull_request.number }} \
--body "Automated changes were made by running \`generate.py\`. Please review the updates."
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
17 changes: 0 additions & 17 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,6 @@ jobs:
pip install pydocstyle
pydocstyle .
generate:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
cache: pip
- name: Verify dockerfiles
run: |
python -m pip install --upgrade pip
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
./generate.py
git diff --exit-code
env-check:
runs-on: ubuntu-latest
permissions:
Expand Down Expand Up @@ -139,7 +123,6 @@ jobs:
complete:
needs:
- lint
- generate
- env-check
- docker-build
runs-on: ubuntu-latest
Expand Down

0 comments on commit e5655b2

Please sign in to comment.