From bf0effbb5ef95372b760c6a57610a08f6954a604 Mon Sep 17 00:00:00 2001 From: Howard Gil Date: Thu, 19 Sep 2024 00:50:07 -0700 Subject: [PATCH] Refactor how we push to main from Action (#411) * adding pip install * refactored how we push changes in yaml --- .../add-notebook-examples-to-docs.yml | 22 ++++++++++--------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/.github/workflows/add-notebook-examples-to-docs.yml b/.github/workflows/add-notebook-examples-to-docs.yml index aa7904db..b59039d3 100644 --- a/.github/workflows/add-notebook-examples-to-docs.yml +++ b/.github/workflows/add-notebook-examples-to-docs.yml @@ -11,6 +11,9 @@ on: workflow_dispatch: +permissions: + contents: write + jobs: add-notebook-examples-to-docs: runs-on: ubuntu-latest @@ -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 \ No newline at end of file + 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 \ No newline at end of file