:chore: llama3 fine tuning tutorial #27
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: Process MDX Files | |
on: | |
pull_request: | |
paths: | |
- '**/*.mdx' | |
jobs: | |
process-mdx: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
ref: ${{ github.event.pull_request.head.ref }} | |
repository: ${{ github.event.pull_request.head.repo.full_name }} | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.x' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install requests | |
sudo apt-get install jq | |
- name: Get list of changed .mdx files | |
id: changed_files | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
echo "Fetching PR details..." | |
PR_NUMBER=$(jq -r .number < "$GITHUB_EVENT_PATH") | |
REPO_FULL_NAME=$(jq -r .pull_request.base.repo.full_name < "$GITHUB_EVENT_PATH") | |
echo "PR Number: $PR_NUMBER" | |
echo "Repository: $REPO_FULL_NAME" | |
RESPONSE=$(curl -s -H "Authorization: token $GITHUB_TOKEN" \ | |
"https://api.github.com/repos/$REPO_FULL_NAME/pulls/$PR_NUMBER/files") | |
echo "GitHub API response: $RESPONSE" | |
CHANGED_FILES=$(echo "$RESPONSE" | jq -r '.[] | select(.filename | endswith(".mdx")) | .filename') | |
echo "CHANGED_FILES=$CHANGED_FILES" >> $GITHUB_ENV | |
echo "Changed files: $CHANGED_FILES" | |
- name: Run image processing script | |
env: | |
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
CHANGED_FILES: ${{ env.CHANGED_FILES }} | |
run: | | |
if [ -z "$CHANGED_FILES" ]; then | |
echo "No .mdx files changed." | |
else | |
echo "Running script with files: $CHANGED_FILES" | |
python scripts/process_images.py $CHANGED_FILES | |
- name: Check for changes | |
id: git_status | |
run: | | |
if [[ -z $(git status --porcelain) ]]; then | |
echo "changes=false" >> $GITHUB_ENV | |
else | |
echo "changes=true" >> $GITHUB_ENV | |
fi | |
- name: Commit and push changes | |
if: env.changes == 'true' | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email 'github-actions[bot]@users.noreply.github.com' | |
git add . | |
git commit -m "Processed images in MDX files" | |
git push origin HEAD:${{ github.head_ref }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |