From 95dd121f9f2f4f87621a86b9e235e9775847e58a Mon Sep 17 00:00:00 2001 From: userdocs <16525024+userdocs@users.noreply.github.com> Date: Wed, 1 Jan 2025 18:28:16 +0000 Subject: [PATCH] workflows --- .github/workflows/ci-alpine-build.yml | 6 ++--- .../workflows/ci-auto-rerun-failed-jobs.yml | 24 +++++++++++++------ .github/workflows/ci-main-reusable-caller.yml | 5 ++-- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci-alpine-build.yml b/.github/workflows/ci-alpine-build.yml index 96f20ba2..9ad762b0 100644 --- a/.github/workflows/ci-alpine-build.yml +++ b/.github/workflows/ci-alpine-build.yml @@ -102,9 +102,9 @@ jobs: printf '%s\n' "disable_qt5=yes" >> $GITHUB_ENV fi - - name: Docker - Copy repo patches to build folder ${{ inputs.distinct_id }} - if: env.disable_qt5 != 'yes' - run: if [[ -d patches ]]; then docker exec -w /root multiarch cp -r patches/* /root/${{ env.qbt_build_dir }}/patches; fi + # - name: Docker - Copy repo patches to build folder ${{ inputs.distinct_id }} + # if: env.disable_qt5 != 'yes' + # run: if [[ -d patches ]]; then docker exec -w /root multiarch cp -r patches/* /root/${{ env.qbt_build_dir }}/patches; fi - name: Docker - zlib-ng ${{ inputs.distinct_id }} if: env.disable_qt5 != 'yes' diff --git a/.github/workflows/ci-auto-rerun-failed-jobs.yml b/.github/workflows/ci-auto-rerun-failed-jobs.yml index 0edf8da9..d5870a3b 100644 --- a/.github/workflows/ci-auto-rerun-failed-jobs.yml +++ b/.github/workflows/ci-auto-rerun-failed-jobs.yml @@ -12,6 +12,12 @@ on: retries: description: "The number of retries to rerun the workflow" required: true + github_repo: + description: "The repository to rerun the workflow" + required: true + distinct_id: + description: "The distinct id of the workflow to rerun" + required: false jobs: gh-cli-rerun: @@ -20,21 +26,25 @@ jobs: actions: write runs-on: ubuntu-latest env: - GH_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + GH_TOKEN: "${{ secrets.PERSONAL_TOKEN || github.token }}" steps: - - name: Host - Checkout action + - name: Host - Checkout action ${{ inputs.distinct_id }} uses: actions/checkout@v4 - - name: gh cli rerun and summaries + - name: gh cli rerun and summaries ${{ inputs.distinct_id }} if: inputs.attempts <= inputs.retries run: | - failures="$(gh run view ${{ inputs.run_id }} --log-failed | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g")" - [[ -z "${failures}" ]] && failures="$(gh run view ${{ inputs.run_id }} | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g")" + github_repo="${{ inputs.github_repo || github.repository }}" + failures="$(gh run view ${{ inputs.run_id }} --log-failed --repo "${github_repo}" | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g")" + + if [[ -z "${failures}" ]]; then + failures="$(gh run view ${{ inputs.run_id }} --repo "${github_repo}" | sed "s,\x1B\[[0-9;]*[a-zA-Z],,g")" + fi if [[ "${{ inputs.retries }}" -ge "2" ]]; then - gh run rerun "${{ inputs.run_id }}" --failed --debug + gh run rerun "${{ inputs.run_id }}" --failed --debug --repo "${github_repo}" else - gh run rerun "${{ inputs.run_id }}" --failed + gh run rerun "${{ inputs.run_id }}" --failed --repo "${github_repo}" fi printf '%b\n' "# gh cli workflow reruns" >> $GITHUB_STEP_SUMMARY diff --git a/.github/workflows/ci-main-reusable-caller.yml b/.github/workflows/ci-main-reusable-caller.yml index c5c293a2..c1f22e3d 100644 --- a/.github/workflows/ci-main-reusable-caller.yml +++ b/.github/workflows/ci-main-reusable-caller.yml @@ -106,10 +106,11 @@ jobs: actions: write runs-on: ubuntu-latest env: - GH_TOKEN: "${{ github.token }}" + GH_TOKEN: "${{ secrets.AUTO_RERUN || github.token }}" steps: - uses: actions/checkout@v4 - name: Trigger rerun workflow on job failures run: | inputs_retries="${{ github.event.inputs.retries }}" - gh workflow run ci-auto-rerun-failed-jobs.yml -f run_id=${{ github.run_id }} -f attempts=${{ github.run_attempt }} -f retries=${inputs_retries:-1} + gh workflow run ci-auto-rerun-failed-jobs.yml --repo "${{ env.github_repo || github.repository }}" -f run_id=${{ github.run_id }} -f attempts=${{ github.run_attempt }} -f retries=${inputs_retries:-1} -f github_repo=${{ github.repository }} -f distinct_id=${{ github.event.inputs.distinct_id }} +