From fb2e040188bef358eea2b726cd8619ec28ae1c6e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Jona=C5=A1?= Date: Mon, 9 Oct 2023 18:24:49 +0200 Subject: [PATCH] docs: add info about self hosted runner (#124) --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/README.md b/README.md index d525af8..134ce35 100644 --- a/README.md +++ b/README.md @@ -103,6 +103,7 @@ jobs: 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`: + ```yaml jobs: myjob: @@ -112,6 +113,43 @@ jobs: contents: 'read' actions: 'read' ``` + + +## Self-hosted runners + +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: + + +```yaml +# ... more CI config ... + +jobs: + myjob: + runs-on: self-hosted + container: my-org/my-amazing-image:v1.2.3-fresh + name: My Job + steps: + - uses: actions/checkout@v3 + with: + # We need to fetch all branches and commits so that Nx affected has a base to compare against. + fetch-depth: 0 + + # Mark your git directory as safe + - name: Set Directory as Safe + run: | + git config --system --add safe.directory "$GITHUB_WORKSPACE" + shell: bash + + - name: Derive appropriate SHAs for base and head for `nx affected` commands + uses: nrwl/nx-set-shas@v4 + + - run: | + echo "BASE: ${{ env.NX_BASE }}" + echo "HEAD: ${{ env.NX_HEAD }}" + + # ... more CI config ... +``` + ## Background