Skip to content

Commit

Permalink
fix skip citations on pr close, remove useless on schedule preview build
Browse files Browse the repository at this point in the history
  • Loading branch information
vincerubinetti committed Aug 7, 2024
1 parent 3a6446a commit 5058761
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
5 changes: 0 additions & 5 deletions .github/workflows/on-schedule.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 8 additions & 2 deletions .github/workflows/update-citations.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,26 +26,28 @@ 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"
cache: "pip"
cache-dependency-path: "**/requirements.txt"

- name: Install Python packages
if: github.event.action != 'closed'
run: |
python -m pip install --upgrade --requirement ./_cite/requirements.txt
Expand All @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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 }}

0 comments on commit 5058761

Please sign in to comment.