Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor how we push to main from Action #411

Merged
merged 11 commits into from
Sep 19, 2024
Merged
22 changes: 12 additions & 10 deletions .github/workflows/add-notebook-examples-to-docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ on:

workflow_dispatch:

permissions:
contents: write

jobs:
add-notebook-examples-to-docs:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -52,15 +55,14 @@ jobs:
fi
done

- name: Commit changes
- name: Add, commit, and push changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git config --global user.name 'Howard Gil'
git config --global user.email 'HowieG@users.noreply.github.com'
git add docs/v1/examples/*.mdx
git diff --quiet && git diff --staged --quiet || git commit -m "GitHub Action: Update examples in docs from notebooks"

- name: Push changes
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: main
if git diff --staged --quiet; then
echo "No changes to commit"
else
git commit -m "GitHub Action: Update examples in docs from notebooks"
git push
fi