From c28bce1a5b2dc8d8f81b62c66550641e772d25cb Mon Sep 17 00:00:00 2001 From: Rahul Patni Date: Mon, 14 Oct 2024 15:42:35 -0700 Subject: [PATCH] Change workflow trigger to run after PR merge Updated the GitHub Actions workflow to trigger the update search index job after a pull request is merged into the master branch. Previously, the job was triggered during the review process, which could lead to unnecessary updates and conflicts with upcoming changes. This change ensures that the search index is only updated with finalized changes, improving the reliability of the index. Adds skip duplicate check: If there are two merges to master than are done in quick succession, the older search index update is cancelled for the new one. --- .github/workflows/update-search-index.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/update-search-index.yml b/.github/workflows/update-search-index.yml index d19c95b4..1009efe3 100644 --- a/.github/workflows/update-search-index.yml +++ b/.github/workflows/update-search-index.yml @@ -1,7 +1,7 @@ name: Update Search Index on: - pull_request: + push: branches: - master @@ -31,6 +31,13 @@ jobs: git config --global user.name 'github-actions[bot]' git config --global user.email 'github-actions[bot]@users.noreply.github.com' + - name: Skip Duplicate Actions + id: skip_check + uses: fkirc/skip-duplicate-actions@v5.3.1 + with: + cancel_others: 'true' + concurrent_skipping: 'outdated_runs' + - name: Extract Branch Name id: extract_branch shell: bash @@ -38,6 +45,7 @@ jobs: echo "::set-output name=branch::${{ github.head_ref }}" - name: Commit and Push Search Index Updates + if: steps.skip_check.outputs.should_skip != 'true' # Only run if not skipped run: | git add -A git commit -m "Update search index" || echo "No changes to commit"