Stable/v0 0 1 #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Manage runners | |
on: [ push, pull_request ] | |
jobs: | |
manage-jobs: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Install GitHub CLI | |
run: | | |
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-key C99B11DEB97541F0 | |
sudo apt-add-repository https://cli.github.com/packages | |
sudo apt update | |
sudo apt install gh | |
- name: Authenticate with GitHub CLI | |
run: echo ${{ secrets.GITHUB_TOKEN }} | gh auth login --with-token | |
- name: Cancel self-hosted job | |
run: | | |
# Get the ID of the running job | |
JOB_ID=$(gh run list --workflow=0-main-self-hosted.yml | grep 'in_progress' | awk '{print $1}') | |
# Cancel the job | |
if [ -n "$JOB_ID" ]; then | |
gh run cancel $JOB_ID | |
else | |
echo "No in_progress runs to cancel" | |
fi | |
- name: Run github-hosted job | |
run: gh workflow run 1-main-github-hosted.yml |