[PR #293] [MERGED] Support running commands in repositories without action.yaml #1405

Closed
opened 2026-03-01 21:51:02 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/nektos/act/pull/293
Author: @jsoref
Created: 6/25/2020
Status: Merged
Merged: 3/30/2021
Merged by: @cplee

Base: masterHead: with-without-action-yml


📝 Commits (8)

  • 9fd1fe2 Comment for public function
  • 284addd Add git describe fallback
  • fe599ba spelling: github
  • 30bb829 Set initial branch to satisfy tests for modern git
  • 935fe73 Clarify -even- if
  • 7b96487 Go 1.16
  • 66b4e38 Support running commands in repositories without action.yaml
  • fd1d208 Merge branch 'master' into with-without-action-yml

📊 Changes

16 files changed (+96 additions, -23 deletions)

View changed files

📝 .github/workflows/push.yml (+11 -2)
📝 .github/workflows/test-expressions.yml (+1 -1)
📝 .github/workflows/test-if.yml (+1 -1)
📝 Makefile (+1 -1)
📝 README.md (+1 -1)
📝 cmd/root.go (+2 -2)
📝 go.mod (+1 -1)
📝 pkg/common/git.go (+1 -0)
📝 pkg/common/git_test.go (+1 -1)
📝 pkg/model/action.go (+12 -9)
📝 pkg/runner/expression_test.go (+1 -1)
pkg/runner/res/trampoline.js (+14 -0)
📝 pkg/runner/run_context.go (+1 -1)
📝 pkg/runner/run_context_test.go (+1 -1)
📝 pkg/runner/runner.go (+1 -1)
📝 pkg/runner/step_context.go (+46 -0)

📄 Description

#246

I'm not claiming this is absolutely correct.

.github/workflows/scrape.yml:

name: Update Price
on: push

jobs:
  scrape:

    runs-on: ubuntu-latest

    strategy:
      matrix:
        node-version: [13.x]

    steps:
      - uses: actions/checkout@v2
      - name: Use Node.js ${{ matrix.node-version }}
        uses: actions/setup-node@v1.4.2
        with:
          node-version: ${{ matrix.node-version }}
      - name: npm install, build, & run
        run: |
          npm i -g yarn
          yarn install
      - name: Run price check
        uses: ianwalter/puppeteer@cbdd5c50c8d6b6275cdf46e4ad2b3f7ee61211ce
        with:
            args: yarn run update-price
      - name: Deploy to gh-pages
        uses: peaceiris/actions-gh-pages@v3
        with:
            github_token: ${{ secrets.GITHUB_TOKEN }}
            publish_dir: ./data
$ act -j scrape
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Update Price/scrape] 🧪  Matrix: map[node-version:13.x]
[Update Price/scrape] 🚀  Start image=node:12.6-buster-slim
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Update Price/scrape]   🐳  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
[Update Price/scrape]   🐳  docker cp src=/Users/jsoref/code/spelling-org/examples.git/. dst=/github/workspace
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Update Price/scrape] ⭐  Run actions/checkout@v2
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Update Price/scrape]   ✅  Success - actions/checkout@v2
ERRO[0000] Unable to interpolate string '${{ matrix.node-version }}' - [ReferenceError: 'version' is not defined]
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Update Price/scrape] ⭐  Run Use Node.js ${{ matrix.node-version }}
[Update Price/scrape]   ☁  git clone 'https://github.com/actions/setup-node' # ref=v1.4.2
[Update Price/scrape]   🐳  docker cp src=/Users/jsoref/.cache/act/actions-setup-node@v1.4.2 dst=/actions/
| [command]/usr/local/bin/node --version
| v12.6.0
| [command]/usr/local/bin/npm --version
| 6.9.0
[Update Price/scrape]##[add-matcher]/actions/actions-setup-node@v1.4.2/.github/tsc.json
[Update Price/scrape]##[add-matcher]/actions/actions-setup-node@v1.4.2/.github/eslint-stylish.json
[Update Price/scrape]##[add-matcher]/actions/actions-setup-node@v1.4.2/.github/eslint-compact.json
[Update Price/scrape]   ✅  Success - Use Node.js ${{ matrix.node-version }}
WARN[0002] unable to get git repo: section 'remote "origin"' does not exist
WARN[0002] unable to get git repo: section 'remote "origin"' does not exist
[Update Price/scrape] ⭐  Run npm install, build, & run
/usr/local/bin/yarnpkg -> /usr/local/lib/node_modules/yarn/bin/yarn.js
| /usr/local/bin/yarn -> /usr/local/lib/node_modules/yarn/bin/yarn.js
| + yarn@1.22.4
| added 1 package in 0.775s
yarn install v1.22.4
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Saved lockfile.
Done in 0.17s.
[Update Price/scrape]   ✅  Success - npm install, build, & run
WARN[0004] unable to get git repo: section 'remote "origin"' does not exist
WARN[0004] unable to get git repo: section 'remote "origin"' does not exist
[Update Price/scrape] ⭐  Run Run price check
[Update Price/scrape]   ☁  git clone 'https://github.com/ianwalter/puppeteer' # ref=cbdd5c50c8d6b6275cdf46e4ad2b3f7ee61211ce
[Update Price/scrape]   🐳  docker cp src=/Users/jsoref/.cache/act/ianwalter-puppeteer@cbdd5c50c8d6b6275cdf46e4ad2b3f7ee61211ce dst=/actions/
[Update Price/scrape]   ✅  Success - Run price check
WARN[0005] unable to get git repo: section 'remote "origin"' does not exist
WARN[0005] unable to get git repo: section 'remote "origin"' does not exist
[Update Price/scrape] ⭐  Run Deploy to gh-pages
[Update Price/scrape]   ☁  git clone 'https://github.com/peaceiris/actions-gh-pages' # ref=v3
[Update Price/scrape]   🐳  docker cp src=/Users/jsoref/.cache/act/peaceiris-actions-gh-pages@v3 dst=/actions/
[Update Price/scrape]   ❓  ::group::Dump inputs
| [INFO] : true
| [INFO] PublishBranch: gh-pages
| [INFO] PublishDir: ./data
| [INFO] ExternalRepository:
| [INFO] AllowEmptyCommit: false
| [INFO] KeepFiles: false
| [INFO] ForceOrphan: false
| [INFO] UserName:
| [INFO] UserEmail:
| [INFO] CommitMessage:
| [INFO] FullCommitMessage:
| [INFO] TagName:
| [INFO] TagMessage:
| [INFO] EnableJekyll (DisableNoJekyll): false
| [INFO] CNAME:
|
[Update Price/scrape]   ❓  ::endgroup::
[Update Price/scrape]   ❗  ::error::Action failed with "Cannot read property 'fork' of undefined"
[Update Price/scrape]   ❌  Failure - Deploy to gh-pages
Error: exit with `FAILURE`: 1

Tentative, based on further comments in the original issue:

.github/workflows/docker-login.yml:

name: Log into Docker
on: push

jobs:
  login:

    runs-on: ubuntu-latest

    steps:
      - name: Trigger docker login
        uses: actions-hub/docker/login@master
$ act -j login
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Log into Docker/login] 🚀  Start image=node:12.6-buster-slim
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Log into Docker/login]   🐳  docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[]
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Log into Docker/login] ⭐  Run Trigger docker login
[Log into Docker/login]   ☁  git clone 'https://github.com/actions-hub/docker' # ref=master
WARN[0000] unable to get git repo: section 'remote "origin"' does not exist
[Log into Docker/login]   🐳  docker build -t act-actions-hub-docker-login-master:latest /Users/jsoref/.cache/act/actions-hub-docker-login@master/login
[Log into Docker/login]   🐳  docker run image=act-actions-hub-docker-login-master:latest entrypoint=[] cmd=[]
[Log into Docker/login]   ❗  ::error::Not authorized. Please check if DOCKER_USERNAME and DOCKER_PASSWORD provided. Exiting....
[Log into Docker/login]   ❌  Failure - Trigger docker login
Error: exit with `FAILURE`: 1

I suspect both cases will want some other fields to be able to migrate over, but I think I'll leave that for later (when someone identifies them, or for someone else to implement).


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/nektos/act/pull/293 **Author:** [@jsoref](https://github.com/jsoref) **Created:** 6/25/2020 **Status:** ✅ Merged **Merged:** 3/30/2021 **Merged by:** [@cplee](https://github.com/cplee) **Base:** `master` ← **Head:** `with-without-action-yml` --- ### 📝 Commits (8) - [`9fd1fe2`](https://github.com/nektos/act/commit/9fd1fe2589793613b94670363e308cca1a46498b) Comment for public function - [`284addd`](https://github.com/nektos/act/commit/284addd4bbf9055cf036830e205cf63ed4785831) Add git describe fallback - [`fe599ba`](https://github.com/nektos/act/commit/fe599ba04dfd83689c791fad7be9c6f2def4f638) spelling: github - [`30bb829`](https://github.com/nektos/act/commit/30bb82918ba529c0279168683d3fd03096462858) Set initial branch to satisfy tests for modern git - [`935fe73`](https://github.com/nektos/act/commit/935fe730fbfdca1bfa047df57ae23f11c39ad094) Clarify -even- if - [`7b96487`](https://github.com/nektos/act/commit/7b9648790dcc84027e5671441b9e50c3eab8f7d0) Go 1.16 - [`66b4e38`](https://github.com/nektos/act/commit/66b4e38629acd7e8355e0e8804407f635f147a0c) Support running commands in repositories without action.yaml - [`fd1d208`](https://github.com/nektos/act/commit/fd1d2083e15c47e7642494f5c2006f457d6c4593) Merge branch 'master' into with-without-action-yml ### 📊 Changes **16 files changed** (+96 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `.github/workflows/push.yml` (+11 -2) 📝 `.github/workflows/test-expressions.yml` (+1 -1) 📝 `.github/workflows/test-if.yml` (+1 -1) 📝 `Makefile` (+1 -1) 📝 `README.md` (+1 -1) 📝 `cmd/root.go` (+2 -2) 📝 `go.mod` (+1 -1) 📝 `pkg/common/git.go` (+1 -0) 📝 `pkg/common/git_test.go` (+1 -1) 📝 `pkg/model/action.go` (+12 -9) 📝 `pkg/runner/expression_test.go` (+1 -1) ➕ `pkg/runner/res/trampoline.js` (+14 -0) 📝 `pkg/runner/run_context.go` (+1 -1) 📝 `pkg/runner/run_context_test.go` (+1 -1) 📝 `pkg/runner/runner.go` (+1 -1) 📝 `pkg/runner/step_context.go` (+46 -0) </details> ### 📄 Description #246 I'm not claiming this is absolutely correct. `.github/workflows/scrape.yml`: ```yaml name: Update Price on: push jobs: scrape: runs-on: ubuntu-latest strategy: matrix: node-version: [13.x] steps: - uses: actions/checkout@v2 - name: Use Node.js ${{ matrix.node-version }} uses: actions/setup-node@v1.4.2 with: node-version: ${{ matrix.node-version }} - name: npm install, build, & run run: | npm i -g yarn yarn install - name: Run price check uses: ianwalter/puppeteer@cbdd5c50c8d6b6275cdf46e4ad2b3f7ee61211ce with: args: yarn run update-price - name: Deploy to gh-pages uses: peaceiris/actions-gh-pages@v3 with: github_token: ${{ secrets.GITHUB_TOKEN }} publish_dir: ./data ``` ```sh $ act -j scrape WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Update Price/scrape] 🧪 Matrix: map[node-version:13.x] [Update Price/scrape] 🚀 Start image=node:12.6-buster-slim WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Update Price/scrape] 🐳 docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] [Update Price/scrape] 🐳 docker cp src=/Users/jsoref/code/spelling-org/examples.git/. dst=/github/workspace WARN[0000] unable to get git repo: section 'remote "origin"' does not exist WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Update Price/scrape] ⭐ Run actions/checkout@v2 WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Update Price/scrape] ✅ Success - actions/checkout@v2 ERRO[0000] Unable to interpolate string '${{ matrix.node-version }}' - [ReferenceError: 'version' is not defined] WARN[0000] unable to get git repo: section 'remote "origin"' does not exist WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Update Price/scrape] ⭐ Run Use Node.js ${{ matrix.node-version }} [Update Price/scrape] ☁ git clone 'https://github.com/actions/setup-node' # ref=v1.4.2 [Update Price/scrape] 🐳 docker cp src=/Users/jsoref/.cache/act/actions-setup-node@v1.4.2 dst=/actions/ | [command]/usr/local/bin/node --version | v12.6.0 | [command]/usr/local/bin/npm --version | 6.9.0 [Update Price/scrape] ❓ ##[add-matcher]/actions/actions-setup-node@v1.4.2/.github/tsc.json [Update Price/scrape] ❓ ##[add-matcher]/actions/actions-setup-node@v1.4.2/.github/eslint-stylish.json [Update Price/scrape] ❓ ##[add-matcher]/actions/actions-setup-node@v1.4.2/.github/eslint-compact.json [Update Price/scrape] ✅ Success - Use Node.js ${{ matrix.node-version }} WARN[0002] unable to get git repo: section 'remote "origin"' does not exist WARN[0002] unable to get git repo: section 'remote "origin"' does not exist [Update Price/scrape] ⭐ Run npm install, build, & run /usr/local/bin/yarnpkg -> /usr/local/lib/node_modules/yarn/bin/yarn.js | /usr/local/bin/yarn -> /usr/local/lib/node_modules/yarn/bin/yarn.js | + yarn@1.22.4 | added 1 package in 0.775s yarn install v1.22.4 info No lockfile found. [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Saved lockfile. Done in 0.17s. [Update Price/scrape] ✅ Success - npm install, build, & run WARN[0004] unable to get git repo: section 'remote "origin"' does not exist WARN[0004] unable to get git repo: section 'remote "origin"' does not exist [Update Price/scrape] ⭐ Run Run price check [Update Price/scrape] ☁ git clone 'https://github.com/ianwalter/puppeteer' # ref=cbdd5c50c8d6b6275cdf46e4ad2b3f7ee61211ce [Update Price/scrape] 🐳 docker cp src=/Users/jsoref/.cache/act/ianwalter-puppeteer@cbdd5c50c8d6b6275cdf46e4ad2b3f7ee61211ce dst=/actions/ [Update Price/scrape] ✅ Success - Run price check WARN[0005] unable to get git repo: section 'remote "origin"' does not exist WARN[0005] unable to get git repo: section 'remote "origin"' does not exist [Update Price/scrape] ⭐ Run Deploy to gh-pages [Update Price/scrape] ☁ git clone 'https://github.com/peaceiris/actions-gh-pages' # ref=v3 [Update Price/scrape] 🐳 docker cp src=/Users/jsoref/.cache/act/peaceiris-actions-gh-pages@v3 dst=/actions/ [Update Price/scrape] ❓ ::group::Dump inputs | [INFO] : true | [INFO] PublishBranch: gh-pages | [INFO] PublishDir: ./data | [INFO] ExternalRepository: | [INFO] AllowEmptyCommit: false | [INFO] KeepFiles: false | [INFO] ForceOrphan: false | [INFO] UserName: | [INFO] UserEmail: | [INFO] CommitMessage: | [INFO] FullCommitMessage: | [INFO] TagName: | [INFO] TagMessage: | [INFO] EnableJekyll (DisableNoJekyll): false | [INFO] CNAME: | [Update Price/scrape] ❓ ::endgroup:: [Update Price/scrape] ❗ ::error::Action failed with "Cannot read property 'fork' of undefined" [Update Price/scrape] ❌ Failure - Deploy to gh-pages Error: exit with `FAILURE`: 1 ``` Tentative, based on further comments in the original issue: `.github/workflows/docker-login.yml`: ```yml name: Log into Docker on: push jobs: login: runs-on: ubuntu-latest steps: - name: Trigger docker login uses: actions-hub/docker/login@master ``` ```sh $ act -j login WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Log into Docker/login] 🚀 Start image=node:12.6-buster-slim WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Log into Docker/login] 🐳 docker run image=node:12.6-buster-slim entrypoint=["/usr/bin/tail" "-f" "/dev/null"] cmd=[] WARN[0000] unable to get git repo: section 'remote "origin"' does not exist WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Log into Docker/login] ⭐ Run Trigger docker login [Log into Docker/login] ☁ git clone 'https://github.com/actions-hub/docker' # ref=master WARN[0000] unable to get git repo: section 'remote "origin"' does not exist [Log into Docker/login] 🐳 docker build -t act-actions-hub-docker-login-master:latest /Users/jsoref/.cache/act/actions-hub-docker-login@master/login [Log into Docker/login] 🐳 docker run image=act-actions-hub-docker-login-master:latest entrypoint=[] cmd=[] [Log into Docker/login] ❗ ::error::Not authorized. Please check if DOCKER_USERNAME and DOCKER_PASSWORD provided. Exiting.... [Log into Docker/login] ❌ Failure - Trigger docker login Error: exit with `FAILURE`: 1 ``` I suspect both cases will want some other fields to be able to migrate over, but I think I'll leave that for later (when someone identifies them, or for someone else to implement). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-01 21:51:02 +03:00
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#1405
No description provided.