[GH-ISSUE #122] actions/checkout always skipped #84

Closed
opened 2026-03-01 21:39:56 +03:00 by kerem · 3 comments
Owner

Originally created by @alexkli on GitHub (Mar 4, 2020).
Original GitHub issue: https://github.com/nektos/act/issues/122

The standard actions/checkout is always skipped, as the user's local working directory is copied in instead.

However, the checkout action supports checking out other repos or branches etc., in which case it should not be skipped.

Example snippet:

    - uses: actions/checkout@v1
      with:
        path: code
    - uses: actions/checkout@v2
      with:
        repository: apache/openwhisk-utilities
        path: openwhisk-utilities

I guess a simple approach is to check whether that action has any with parameters or not. If yes, run it, if not, skip it.

Note the problem is exaggerated as it seems impossible to find a working action that allows running arbitrary git commands as a workaround to this issue.

Originally created by @alexkli on GitHub (Mar 4, 2020). Original GitHub issue: https://github.com/nektos/act/issues/122 The standard [actions/checkout](https://github.com/actions/checkout) is [always skipped](https://github.com/nektos/act/blob/6e1da1a70da1a9cd04ff243489f3edf609e32f0c/pkg/runner/step_context.go#L61), as the user's local working directory is copied in instead. However, the checkout action supports checking out other repos or branches etc., in which case it should not be skipped. Example snippet: ``` - uses: actions/checkout@v1 with: path: code - uses: actions/checkout@v2 with: repository: apache/openwhisk-utilities path: openwhisk-utilities ``` I guess a simple approach is to check whether that action has any `with` parameters or not. If yes, run it, if not, skip it. Note the problem is exaggerated as it seems impossible to find a working action that allows running arbitrary `git` commands as a workaround to this issue.
kerem 2026-03-01 21:39:56 +03:00
Author
Owner

@alexkli commented on GitHub (Mar 4, 2020):

Also, for the first checkout in my example above, the path is ignored. It should copy the local dir into that path instead of the workspace root.

<!-- gh-comment-id:594293805 --> @alexkli commented on GitHub (Mar 4, 2020): Also, for the first checkout in my example above, the `path` is ignored. It should copy the local dir into that `path` instead of the workspace root.
Author
Owner

@alexkli commented on GitHub (Mar 4, 2020):

My temporary workaround was to manually check out that other repo in my local dir first, before starting act.

BTW, thanks for a great tool! Really helped developing my actions! 👍🙏

<!-- gh-comment-id:594300627 --> @alexkli commented on GitHub (Mar 4, 2020): My temporary workaround was to manually check out that other repo in my local dir first, before starting act. BTW, thanks for a great tool! Really helped developing my actions! 👍🙏
Author
Owner

@yanniszark commented on GitHub (Mar 7, 2020):

Adding another datapoint to this.
I cannot find a way to build a Go project which uses GOPATH.
GOPATH is an (older) Go convention that when importing a package it must be under $GOPATH.
eg for

import "github.com/scylladb/scylla-operator/pkg/apis"

I must have the directory structure $GOPATH/github.com/scylladb/scylla-operator/pkg/apis

This is achieved using the path argument in actions/checkout@v2.
However, this isn't working in act so I can't run my workflow locally.

Here is the workflow I'm using for reference:

name: Go

on:
  push:
    branches: [ master ]
  pull_request:
    branches: [ master ]

jobs:

  build:
    name: Build
    env:
      GOPATH: ${{ github.workspace }}
      GO111MODULE: off
    runs-on: ubuntu-18.04
    steps:

    - name: Set up Go 1.13
      uses: actions/setup-go@v1
      with:
        go-version: 1.13
      id: go

    - name: Check out code into the Go module directory
      uses: actions/checkout@v2
      with:
        path: ./src/github.com/${{ github.repository }}

    - name: Install make
      run: apt-get update && apt-get install -y build-essential

    - name: Build
      run: make local-build
<!-- gh-comment-id:596097972 --> @yanniszark commented on GitHub (Mar 7, 2020): Adding another datapoint to this. I cannot find a way to build a Go project which uses GOPATH. GOPATH is an (older) Go convention that when importing a package it must be under $GOPATH. eg for ```go import "github.com/scylladb/scylla-operator/pkg/apis" ``` I must have the directory structure `$GOPATH/github.com/scylladb/scylla-operator/pkg/apis` This is achieved using the path argument in actions/checkout@v2. However, this isn't working in act so I can't run my workflow locally. Here is the workflow I'm using for reference: <details> ```yaml name: Go on: push: branches: [ master ] pull_request: branches: [ master ] jobs: build: name: Build env: GOPATH: ${{ github.workspace }} GO111MODULE: off runs-on: ubuntu-18.04 steps: - name: Set up Go 1.13 uses: actions/setup-go@v1 with: go-version: 1.13 id: go - name: Check out code into the Go module directory uses: actions/checkout@v2 with: path: ./src/github.com/${{ github.repository }} - name: Install make run: apt-get update && apt-get install -y build-essential - name: Build run: make local-build ``` </details>
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/act#84
No description provided.