diff --git a/README.md b/README.md index 9dcafde..3621a24 100644 --- a/README.md +++ b/README.md @@ -116,3 +116,13 @@ You can delete an existing runner by its Linux username. ```bash ./mr.bash del --user ``` + +### Specify runner in workflow file +In [`jobs..runs-on`](https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idruns-on), target runners can be based on the labels as follows via [GitHub context](https://docs.github.com/en/actions/learn-github-actions/contexts#github-context): +```yaml +# For organization level self-hosted runners +runs-on: [self-hosted, ${{ github.repository_owner }}] + +# For repository level self-hosted runners +runs-on: [self-hosted, ${{ github.repository }}] +``` \ No newline at end of file diff --git a/mr.bash b/mr.bash index a405810..8d7e559 100755 --- a/mr.bash +++ b/mr.bash @@ -214,9 +214,9 @@ function mr::addRunner { local name="$user@$HOSTNAME" - local labels="controller:vbem/multi-runners,username:$user,hostname:$HOSTNAME,org:$org" - [[ -n "$repo" ]] && labels="$labels,repo:$repo" + local labels="controller:$USER@$HOSTNAME:$DIR_THIS/$FILE_THIS" [[ -r /etc/os-release ]] && labels="$labels,os:$(source /etc/os-release && echo $ID-$VERSION_ID)" + [[ -n "$repo" ]] && labels="$labels,$org/$repo" || labels="$labels,$org" [[ -n "$extraLabels" ]] && labels="$labels,$extraLabels" local url=''