ci: some scheduled workflows should only run on emqx/emqx

This commit is contained in:
Ivan Dyachkov 2024-05-10 16:24:21 +02:00
parent c491b83857
commit 7ab06bcdc9
4 changed files with 9 additions and 6 deletions

View File

@ -10,6 +10,7 @@ permissions:
jobs: jobs:
analyze: analyze:
if: github.repository == 'emqx/emqx'
name: Analyze name: Analyze
runs-on: ubuntu-22.04 runs-on: ubuntu-22.04
timeout-minutes: 360 timeout-minutes: 360

View File

@ -30,9 +30,10 @@ jobs:
shell: bash shell: bash
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPO: ${{ github.repository }}
run: | run: |
gh api --method GET -f head_sha=$(git rev-parse HEAD) -f status=completed -f exclude_pull_requests=true /repos/emqx/emqx/actions/runs > runs.json gh api --method GET -f head_sha=$(git rev-parse HEAD) -f status=completed -f exclude_pull_requests=true /repos/${GITHUB_REPO}/actions/runs > runs.json
for id in $(jq -r '.workflow_runs[] | select((."conclusion" == "failure") and (."name" != "Keep master green") and .run_attempt < 3) | .id' runs.json); do for id in $(jq -r '.workflow_runs[] | select((."conclusion" == "failure") and (."name" != "Keep master green") and .run_attempt < 3) | .id' runs.json); do
echo "rerun https://github.com/emqx/emqx/actions/runs/$id" echo "rerun https://github.com/${GITHUB_REPO}/actions/runs/$id"
gh api --method POST /repos/emqx/emqx/actions/runs/$id/rerun-failed-jobs || true gh api --method POST /repos/${GITHUB_REPO}/actions/runs/$id/rerun-failed-jobs || true
done done

View File

@ -16,8 +16,9 @@ permissions: read-all
jobs: jobs:
analysis: analysis:
if: github.repository == 'emqx/emqx'
name: Scorecard analysis name: Scorecard analysis
runs-on: ubuntu-latest runs-on: ubuntu-22.04
permissions: permissions:
security-events: write security-events: write
id-token: write id-token: write

View File

@ -13,8 +13,8 @@ permissions:
jobs: jobs:
stale: stale:
if: github.repository_owner == 'emqx' if: github.repository == 'emqx/emqx'
runs-on: ${{ endsWith(github.repository, '/emqx') && 'ubuntu-22.04' || fromJSON('["self-hosted","ephemeral","linux","x64"]') }} runs-on: ubuntu-22.04
permissions: permissions:
issues: write issues: write
pull-requests: none pull-requests: none