From a51ed062ca1d78d2e5158509fdfce82e761e1734 Mon Sep 17 00:00:00 2001 From: DevTekVE Date: Thu, 6 Mar 2025 10:24:14 +0100 Subject: [PATCH] CI: allow 1 retry for first time contributor and fork and skip sync lfs on fork PRs (#646) * Update workflow condition to skip forked PRs during sync This change ensures the LFS maintenance workflow does not run for pull requests originating from forked repositories. It enhances efficiency by avoiding unnecessary sync actions in these cases. * Modified retry conditions in GitHub workflow file Adjusted the retry conditions in the GitHub workflow setup file. The updated condition allows for a second attempt if the pull request originator is a 'FIRST_TIME_CONTRIBUTOR' from a forked repository. This modification lends more flexibility to first-time contributors by providing them with an additional chance to pass the tests. --- .github/workflows/lfs-maintenance.yaml | 2 +- .github/workflows/setup/action.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lfs-maintenance.yaml b/.github/workflows/lfs-maintenance.yaml index d2e7bb2e7e..019262715a 100644 --- a/.github/workflows/lfs-maintenance.yaml +++ b/.github/workflows/lfs-maintenance.yaml @@ -23,7 +23,7 @@ jobs: sync: runs-on: ubuntu-latest # Skip if PR is in draft mode - if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) + if: github.event_name != 'pull_request' || (github.event_name == 'pull_request' && github.event.pull_request.draft == false) || !github.event.pull_request.head.repo.fork steps: - name: Checkout Repository uses: actions/checkout@v4 diff --git a/.github/workflows/setup/action.yaml b/.github/workflows/setup/action.yaml index 818060c3b0..181ad54eaf 100644 --- a/.github/workflows/setup/action.yaml +++ b/.github/workflows/setup/action.yaml @@ -19,7 +19,7 @@ runs: - shell: bash name: No retries! run: | - if [ "${{ github.run_attempt }}" -gt 1 ]; then + if [ "${{ github.run_attempt }}" -gt ${{ github.event.pull_request.head.repo.fork && github.event.pull_request.author_association == 'FIRST_TIME_CONTRIBUTOR' && 2 || 1}} ]; then echo -e "\033[0;31m##################################################" echo -e "\033[0;31m Retries not allowed! Fix the flaky test! " echo -e "\033[0;31m##################################################\033[0m"