From 774919130d95adbf99c948b88cc0bde31badccfa Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 22 Aug 2026 18:13:25 +0200 Subject: [PATCH] action: make working-directory optional The action currently sets GOPATH to github.workspace to make its installed helper commands available. This causes projects checked out at the workspace root to fail with "$GOPATH/go.mod exists but should not", forcing callers to use a legacy GOPATH-style checkout path. Install the helper commands in a dedicated directory under runner.temp and add that directory to PATH without modifying the caller's GOPATH. Default working-directory to "." so projects using a standard root checkout do not need to configure it, while retaining support for projects located in a subdirectory. Signed-off-by: Sebastiaan van Stijn --- action.yml | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/action.yml b/action.yml index 67c1f0f..11f60e2 100644 --- a/action.yml +++ b/action.yml @@ -17,29 +17,27 @@ # jobs: # project: # name: Project Checks -# runs-on: ubuntu-22.04 +# runs-on: ubuntu-latest # timeout-minutes: 5 # # steps: -# - uses: actions/setup-go@v3 +# - uses: actions/checkout@v7 # with: -# go-version: '1.19' +# fetch-depth: 100 # -# - uses: actions/checkout@v3 +# - uses: actions/setup-go@v7 # with: -# path: src/github.com/containerd/containerd -# fetch-depth: 100 +# go-version: stable # # - name: Project checks -# uses: containerd/project-checks@v1.1.0 -# with: -# working-directory: src/github.com/containerd/containerd +# uses: containerd/project-checks@v1.2.3 # name: Project Checks description: Project checks commonly used across containerd org inputs: working-directory: - required: true + required: false + default: . description: Go project path to run checks in go-mod-tidy-flags: required: false @@ -55,13 +53,12 @@ runs: steps: - name: Set env shell: bash - run: | - echo "GOPATH=${{ github.workspace }}" >> $GITHUB_ENV - echo "${{ github.workspace }}/bin" >> $GITHUB_PATH + run: echo "${RUNNER_TEMP}/project-checks/bin" >> "$GITHUB_PATH" - name: Install dependencies shell: bash env: + GOBIN: ${{ runner.temp }}/project-checks/bin GO111MODULE: on run: | echo "::group::🚧 Get dependencies"