Test proofread action #1
Workflow file for this run
This file contains hidden or 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: Proofread Markdown Files | |
on: | |
pull_request: | |
types: [opened, synchronize, reopened] | |
jobs: | |
proofread: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 # Fetch all history for accurate diff | |
- name: Set up Python | |
uses: actions/setup-python@v4 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
pip install openai PyGithub | |
- name: Get list of changed Markdown files | |
id: changed_files | |
run: | | |
git fetch origin ${{ github.base_ref }} ${{ github.head_ref }} | |
FILES=$(git diff --name-only origin/${{ github.base_ref }}...origin/${{ github.head_ref }} -- '*.md') | |
echo "files<<EOF" >> $GITHUB_OUTPUT | |
echo "${FILES}" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Proofread changed Markdown files | |
if: steps.changed_files.outputs.files != '' | |
run: | | |
echo "${{ steps.changed_files.outputs.files }}" > changed_files.txt | |
python proofread.py changed_files.txt | |
env: | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GITHUB_REPOSITORY: ${{ github.repository }} | |
PR_NUMBER: ${{ github.event.number }} |