Skip to content

Commit fb2e040

Browse files
authored
docs: add info about self hosted runner (nrwl#124)
1 parent 27d031a commit fb2e040

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

README.md

+38
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ jobs:
103103
104104
This Action uses Github API to find the last successful workflow run. If your `GITHUB_TOKEN` has restrictions set please ensure you override them for the workflow to enable read access to `actions` and `contents`:
105105

106+
<!-- start permissions-in-v2 -->
106107
```yaml
107108
jobs:
108109
myjob:
@@ -112,6 +113,43 @@ jobs:
112113
contents: 'read'
113114
actions: 'read'
114115
```
116+
<!-- end permissions-in-v2 -->
117+
118+
## Self-hosted runners
119+
120+
This Action supports usage of your own self-hosted runners, but since it uses GitHub APIs you will need to grant it explicit access rights:
121+
122+
<!-- self-hosted runners -->
123+
```yaml
124+
# ... more CI config ...
125+
126+
jobs:
127+
myjob:
128+
runs-on: self-hosted
129+
container: my-org/my-amazing-image:v1.2.3-fresh
130+
name: My Job
131+
steps:
132+
- uses: actions/checkout@v3
133+
with:
134+
# We need to fetch all branches and commits so that Nx affected has a base to compare against.
135+
fetch-depth: 0
136+
137+
# Mark your git directory as safe
138+
- name: Set Directory as Safe
139+
run: |
140+
git config --system --add safe.directory "$GITHUB_WORKSPACE"
141+
shell: bash
142+
143+
- name: Derive appropriate SHAs for base and head for `nx affected` commands
144+
uses: nrwl/nx-set-shas@v4
145+
146+
- run: |
147+
echo "BASE: ${{ env.NX_BASE }}"
148+
echo "HEAD: ${{ env.NX_HEAD }}"
149+
150+
# ... more CI config ...
151+
```
152+
<!-- end self-hosted runners -->
115153

116154
## Background
117155

0 commit comments

Comments
 (0)