diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index 0cf82f4..643ba0f 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -124,7 +124,7 @@ jobs: echo "changes=$changes" >> $GITHUB_OUTPUT git add . --force git commit -m 'Render preview' || echo "No changes to commit" - git pull --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours + git pull --rebase --set-upstream origin $branch_name --allow-unrelated-histories --strategy-option=ours git push --force || echo "No changes to commit" shell: bash diff --git a/.github/workflows/render-site.yml b/.github/workflows/render-site.yml index a75ad3c..cf214ec 100644 --- a/.github/workflows/render-site.yml +++ b/.github/workflows/render-site.yml @@ -70,6 +70,7 @@ jobs: exit 1 # Commit the rendered site files - html files and site_libs files +# The git reset step will remove any other files created in this workflow, such as API keys - name: Commit rendered site files run: | git config --global --add safe.directory $GITHUB_WORKSPACE @@ -77,4 +78,6 @@ jobs: git config --global user.email 'github-actions[bot]@users.noreply.github.com' git add --force docs/* git commit -m 'Render site' || echo "No changes to commit" - git push --force origin main || echo "No changes to push" + git reset --hard HEAD + git pull --rebase --allow-unrelated-histories --strategy-option=ours + git push origin main || echo "No changes to push"