diff --git a/.github/workflows/removed_runner.yml b/.github/workflows/removed_runner.yml index a8a94ea..d7efee9 100644 --- a/.github/workflows/removed_runner.yml +++ b/.github/workflows/removed_runner.yml @@ -18,14 +18,20 @@ jobs: test-removed-runner: name: Test Removed Runner runs-on: ubuntu-latest - env: - GH_TOKEN: ${{ secrets.READ_REPO_TOKEN }} + steps: - - name: Check runner removal + - name: List runners + run: | + echo "RUNNERS_FOUND=$(gh api "repos/zama-ai/slab-github-runner/actions/runners" --jq '.runners[].name')" >> "${GITHUB_ENV}" + env: + GH_TOKEN: ${{ secrets.READ_REPO_TOKEN }} + + - name: Check runner removed + if: inputs.must-exist == false + run: | + ( echo "${{ env.RUNNERS_FOUND }}" | grep --line-regexp -q "${{ inputs.runner-name }}" ) && { exit 1; } || exit 0 + + - name: Check runner persists + if: inputs.must-exist == true run: | - RUNNERS_FOUND=$(gh api "repos/zama-ai/slab-github-runner/actions/runners" --jq '.runners[].name') - if [ ${{ inputs.must-exist }} == true ]; then - echo "$RUNNERS_FOUND" | grep -w "${{ inputs.runner-name }}" || exit 1 - else - echo "$RUNNERS_FOUND" | grep -w "${{ inputs.runner-name }}" || exit 0 - fi + ( echo "${{ env.RUNNERS_FOUND }}" | grep --line-regexp -q "${{ inputs.runner-name }}" ) || exit 1 \ No newline at end of file diff --git a/.github/workflows/test_spawn_terminate.yml b/.github/workflows/test_spawn_terminate.yml index 24e39e9..0c7fa35 100644 --- a/.github/workflows/test_spawn_terminate.yml +++ b/.github/workflows/test_spawn_terminate.yml @@ -41,7 +41,7 @@ jobs: - name: Generate output id: gen-output run: | - echo "runner_${{ matrix.provider }}=${{ steps.test-start.outputs.label }}" >> "$GITHUB_OUTPUT" + echo "runner_${{ matrix.provider }}=${{ steps.test-start.outputs.label }}" >> "${GITHUB_OUTPUT}" test-runner-alive-aws: name: Test runner is alive (AWS) diff --git a/.github/workflows/test_start_stop.yml b/.github/workflows/test_start_stop.yml index b998e77..af3f9ae 100644 --- a/.github/workflows/test_start_stop.yml +++ b/.github/workflows/test_start_stop.yml @@ -64,5 +64,6 @@ jobs: uses: ./.github/workflows/removed_runner.yml with: runner-name: ci-persistent-runner + must-exist: true secrets: - READ_REPO_TOKEN: ${{ secrets.READ_REPO_TOKEN }} \ No newline at end of file + READ_REPO_TOKEN: ${{ secrets.SLAB_ACTION_TOKEN }} \ No newline at end of file