Skip to content

Commit

Permalink
fix: refactor workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
GangGreenTemperTatum committed Jan 25, 2025
1 parent 1c5aa6b commit c606893
Showing 1 changed file with 14 additions and 29 deletions.
43 changes: 14 additions & 29 deletions .github/workflows/rigging_pr_description.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ name: Update PR Description with Rigging

on:
pull_request:
types:
- edited # Trigger when the PR is updated (e.g., title, description, or labels)
- reopened # Trigger when the PR is reopened
types: [opened, synchronize]

jobs:
update-description:
Expand All @@ -14,50 +12,37 @@ jobs:
contents: read

steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 #v4.2.2
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
fetch-depth: 0
fetch-depth: 0 # full history for proper diffing

# Get the diff first
- name: Get Diff
id: diff
run: |
git fetch origin ${{ github.base_ref }}
MERGE_BASE=$(git merge-base HEAD origin/${{ github.base_ref }})
# Encode the diff as base64 to preserve all characters
DIFF=$(git diff $MERGE_BASE..HEAD | base64 -w 0)
echo "diff=$DIFF" >> $GITHUB_OUTPUT
- uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b #v5.0.3
- name: Set up Python
uses: actions/setup-python@0b93645e9fea7318ecaed2b359559ac225c90a2b # v5.0.3
with:
python-version: "3.11"
python-version: "3.10"

- name: Install dependencies
- name: Install uv
run: |
python -m pip install --upgrade pip
pip cache purge
pip install pydantic==2.9.1
pip install rigging[all]
pip install uv
# Generate the description using the diff
- name: Generate PR Description
id: description
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
PR_NUMBER: ${{ github.event.pull_request.number }}
GIT_DIFF: ${{ steps.diff.outputs.diff }}
run: |
python .github/scripts/rigging_pr_decorator.py
DESCRIPTION=$(uv run --no-project .github/scripts/rigging_pr_decorator.py origin/${{ github.base_ref }})
echo "description<<EOF" >> $GITHUB_OUTPUT
echo "$DESCRIPTION" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
# Update the PR description
- name: Update PR Description
uses: nefrob/pr-description@4dcc9f3ad5ec06b2a197c5f8f93db5e69d2fdca7 #v1.2.0
uses: nefrob/pr-description@4dcc9f3ad5ec06b2a197c5f8f93db5e69d2fdca7 # v1.2.0
with:
content: |
## AI-Generated Summary
${{ steps.description.outputs.content }}
${{ steps.description.outputs.description }}
---
Expand Down

0 comments on commit c606893

Please sign in to comment.