Skip to content

Update utilities

Update utilities #2

name: README Update Automation
on:
pull_request:
types: [closed]
jobs:
update-readme:
name: Update README after PR merge
runs-on: ubuntu-latest
if: github.event.pull_request.merged == true
steps:
# Check out the repo to access its content
- name: Checkout Repository
uses: actions/checkout@v4
# Set up Python using the latest stable version
- name: Setup Python
uses: actions/setup-python@v3
with:
python-version: '3.12'
# Install Python dependencies
- name: Install Dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
# Extract PR Number and Commit SHA from the GitHub event context
- name: Get PR info
id: pr_info
run: |
pr_num=$(jq -r .pull_request.number "$GITHUB_EVENT_PATH")
commit_sha=$(jq -r .pull_request.head.sha "$GITHUB_EVENT_PATH")
echo "pull_request_number=$pr_num" >> $GITHUB_ENV
echo "commit_sha=$commit_sha" >> $GITHUB_ENV
# Run the Python script
- name: Generate Updated README
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}
REPO_PATH: ${{ github.repository }}
PR_NUMBER: ${{ env.pull_request_number }}
COMMIT_SHA: ${{ env.commit_sha }}
run: python main.py
# Additional step to enable debugging, helps in troublshooting
- name: Enable Debug Logging
run: |
echo "ACTIONS_STEP_DEBUG=true" >> $GITHUB_ENV