From 50587611ebf801657ea012ad71b9052c4a98f5b1 Mon Sep 17 00:00:00 2001 From: Vincent Rubinetti Date: Wed, 7 Aug 2024 17:40:12 -0400 Subject: [PATCH] fix skip citations on pr close, remove useless on schedule preview build --- .github/workflows/on-schedule.yaml | 5 ----- .github/workflows/update-citations.yaml | 10 ++++++++-- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/on-schedule.yaml b/.github/workflows/on-schedule.yaml index ad1fe95a7a..e1f8898b19 100644 --- a/.github/workflows/on-schedule.yaml +++ b/.github/workflows/on-schedule.yaml @@ -20,8 +20,3 @@ jobs: uses: ./.github/workflows/update-citations.yaml with: open-pr: true - - build-preview: - needs: update-citations - if: needs.update-citations.outputs.changed == 'true' - uses: ./.github/workflows/build-preview.yaml diff --git a/.github/workflows/update-citations.yaml b/.github/workflows/update-citations.yaml index d0a979180b..6b48c55c25 100644 --- a/.github/workflows/update-citations.yaml +++ b/.github/workflows/update-citations.yaml @@ -26,19 +26,20 @@ jobs: update-citations: runs-on: ubuntu-latest timeout-minutes: 15 - if: github.event.action != 'closed' steps: - name: Debug dump uses: crazy-max/ghaction-dump-context@v2 - name: Checkout branch contents + if: github.event.action != 'closed' uses: actions/checkout@v4 with: repository: ${{ github.event.pull_request.head.repo.full_name }} ref: ${{ github.head_ref }} - name: Setup Python + if: github.event.action != 'closed' uses: actions/setup-python@v5 with: python-version: "3.11" @@ -46,6 +47,7 @@ jobs: cache-dependency-path: "**/requirements.txt" - name: Install Python packages + if: github.event.action != 'closed' run: | python -m pip install --upgrade --requirement ./_cite/requirements.txt @@ -54,10 +56,12 @@ jobs: uses: mxschmitt/action-tmate@v3 - name: Build updated citations + if: github.event.action != 'closed' run: python _cite/cite.py timeout-minutes: 15 - name: Check if citations changed + if: github.event.action != 'closed' id: changed uses: tj-actions/verify-changed-files@v18 with: @@ -66,6 +70,7 @@ jobs: - name: Commit updated citations to branch if: | + github.event.action != 'closed' && steps.changed.outputs.files_changed == 'true' && inputs.open-pr != true uses: stefanzweifel/git-auto-commit-action@v5 @@ -74,6 +79,7 @@ jobs: - name: Open pull request with updated citations if: | + github.event.action != 'closed' && steps.changed.outputs.files_changed == 'true' && inputs.open-pr == true uses: peter-evans/create-pull-request@v6 @@ -84,4 +90,4 @@ jobs: To see a live preview of this PR, close (not merge) and reopen it. outputs: - changed: ${{ steps.changed.outputs.files_changed }} + changed: ${{ steps.changed.outputs.files_changed || false }}