Commit graph

38 commits

Author SHA1 Message Date
Ryan (hackercat)
a9fe038347
Update images, fix extrapath (#723)
* fix: typo

* fix: remove debug for git references

it generates a massive amount of logs

* feat: read values from env

allows to test act on GHA when it's not a main repo

* fix: merge extrapath with PATH

* fix(tests): add additional shells for testing

* fix(image): update images

pin node to major version only, current node version: 12.22.1
replace most images with `node:12-buster-slim` to prevent
errors on macOS runner due to DockerHub pull limit
replace ocaml image

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-06-10 23:12:05 +00:00
Björn Brauer
60b9606fc6
fix: use github auth token for pulling a repository (#693)
Co-Authored-By: Markus Wolf <markus.wolf@new-work.se>

Co-authored-by: Markus Wolf <markus.wolf@new-work.se>
2021-05-19 13:40:28 +00:00
Markus Wolf
38f6dfb49a
fix: use auth when fetching (same as with cloning) (#687)
Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>

Co-authored-by: Björn Brauer <bjoern.brauer@new-work.se>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-05-18 06:25:07 +00:00
Ryan (hackercat)
aa68181f6b
refactor: return more errors, add more tests (#679)
adding more tests
returns same message for short SHA format like GitHub Actions
refactor error checking
add more errors :)
2021-05-08 03:29:03 +00:00
Markus Wolf
a07cb440c2
Write git clone progress only if terminal is a TTY (#670) 2021-05-06 06:55:23 -07:00
Björn Brauer
0c4374ec41
GitHub Enterprise support (#658)
* Add option to specify custom GitHub instance

* Use correct GHE API endpoint URLs

Co-authored-by: Markus Wolf <knister.peter@shadowrun-clan.de>

* Extract slug from GitHub Enterprise URLs

Co-authored-by: Markus Wolf <knister.peter@shadowrun-clan.de>

* Use GITHUB_TOKEN for clone authenticate if provided

This change will allow use authentication for cloning actions
from private repositories or github enterprise instances.

Co-Authored-By: Markus Wolf <knister.peter@shadowrun-clan.de>

* Add section about using act on GitHub Enterprise to README

Co-authored-by: Markus Wolf <knister.peter@shadowrun-clan.de>

* Set GitHubInstance in runnerConfig in runner_test

Co-authored-by: Markus Wolf <knister.peter@shadowrun-clan.de>

Co-authored-by: hackercat <me@hackerc.at>
Co-authored-by: Markus Wolf <knister.peter@shadowrun-clan.de>
2021-05-05 09:42:34 -07:00
Ryan (hackercat)
cec63488f3
Add super-linter + fix lint issues (#650)
* feat: bump `golangci-lint`, add `super-linter`, replace outdated linter

Bump `golangci-lint` version.
Add `super-linter` to lint other languages.
Go linter is disabled because it's currently broken:
https://github.com/github/super-linter/pull/370
Replacing `scopelint` with `exportloopref`: "[runner] The linter
'scopelint' is deprecated (since v1.39.0) due to: The repository of the
linter has been deprecated by the owner.  Replaced by exportloopref."
Fixed formatting in `.golangci.yml`
Add addtional linters:
  `misspell`: purely style, detects typos in comments
  `whitespace`: detects leading and trailing whitespace
  `goimports`: it's gofmt + checks unused imports

* fix: lint/fix `go` files

* fix: lint with `standardjs`

* fix: lint/fix with `markdownlint`, make template more verbose

* feat: add lint stuff to makefile

* fix: `UseGitIgnore` formatting

* fix: lint/fix `README.md`

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-05-03 09:52:03 -07:00
Robert Stupp
ea7503bc25
Prefer go-git to find the reference name (#633)
Walking the directory tree underneath `.git/refs` is not reliable, as it usually does not
return tags, especially for freshly cloned repos and/or tags fetched from a remote.

The go-git library provides an iterator over all git references.

This approach prefers a reference (tag, branch) from go-git, if found. If none is found,
it falls back to the previous implementation.
2021-05-03 07:32:00 -07:00
KADOTA, Kyohei
010e459e95
Clean the repository cache if it is in incomplete state (#595) 2021-04-06 06:43:02 -07:00
Josh Soref
5752a03dcd
Support running commands in repositories without action.yaml (#293)
* Comment for public function

* Add git describe fallback

* spelling: github

* Set initial branch to satisfy tests for modern git

* Clarify -even- if

* Go 1.16

* Support running commands in repositories without action.yaml

Support runnings commands with only a Docker file

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-03-30 12:26:25 -07:00
hackercat
eb2774275f
Fix tests on Windows (#562)
* fix: replace `\` with `/` in git ref to fix `git_test.go` on windows

Paths on Windows use backslash (`\`) as directory separator and this breaks `TestGitFindRef()`.
Replacing `\` with `/` in git ref fixes that issue.

* fix: replace `gopkg.in/godo.v2/glob` with std library `path/filepath`

`github.com/go-godo/godo` lib has been last updated in 2016 and it also
depends on another outdated lib `github.com/MichaelTJones/walk` with
last update in 2016. This also fixes `permission_denied` errors on
Windows (and perhaps Linux in some specific cases). I'm not aware of
any performance improvement or drawback because of that change.
2021-03-12 16:23:03 -08:00
Shin Uozumi
14c06ee5e4
enable to resolve commit hash in uses (#530)
Co-authored-by: sinozu <sinozu@users.noreply.github.com>
Co-authored-by: Casey Lee <cplee@nektos.com>
2021-02-23 09:50:28 -08:00
Shin Uozumi
9bf37fb868
Fix indent with go fmt (#531)
Co-authored-by: sinozu <sinozu@users.noreply.github.com>
2021-02-17 11:47:59 -08:00
Ed
56ec36726b
Fix Cartesian product to return empty set if empty set is given (#503)
This fixes #499, where a matrix strategy with only include keys ends up
causing multiple builds.  This bugs appears to have been introduced in #415,
when extra include keys are added in the matrix strategy.  The cause
seems to be because the CartesianProduct function returns an item with
empty keys, instead of return an empty set.

Co-authored-by: Ed Tan <edtan@users.noreply.github.com>
2021-01-23 14:55:54 -08:00
KADOTA, Kyohei
6e1cdeefc0
Fix "reference not found" error on checkout (#433) (#471) 2021-01-14 21:24:17 -08:00
KADOTA, Kyohei
1b38d5c4d9
Fix "reference not found" error (#433)
If an action uses the branch to pin the major version, `- use: user/action@v1`
will stop with an error: "v1: reference not found."

In this case `act` should use refs/remotes/origin/v1 as a name to resolve v1 revision.

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-01-11 22:47:33 -08:00
Torbjørn Vatn
15eaa15a0e
GitHub env file support (#426)
* Upgrade to the official golangci-lint action and fix some issues it found

* Update deps

* Remove a shadow warning

* Initialize the splitPattern only once

* Initial attempt at supporting $GITHUB_ENV

Needs some polishing and tests

* Now it's actually working

* Replace golang.org/x/crypto/ssh/terminal with golang.org/x/term

* Disable the issue-228 test again

* The linter is picky

* Discovered that the workflow/envs.txt had to exist in certain cases

* Fix small linter issue
2021-01-11 22:39:43 -08:00
KADOTA, Kyohei
8887daa3e7
Fix tests if there are hooks generated by templates (#434)
If there are custom hooks in ~/.git_template/hooks,
they can occur an error on such as pre-commit hooks.

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-01-11 22:35:57 -08:00
Stephen Solka
85a47838fd
use t.Cleanup and prefer assert.NoError over .Nil (#309)
Co-authored-by: Casey Lee <cplee@nektos.com>
2020-07-20 07:35:43 -07:00
Michael Heap
dfd1fee7fe
Pull latest changes from ref using cached repo (#267)
* Pull latest changes from ref using cached repo

Act switched from checking out a branch to checking out
a hash in order to resolve #24 - see
bc5c23e8e4

This had a side effect of preventing `w.Pull()` from updating
to the latest commit if a ref was a branch/tag and the repo
already exists on disk.

This commit checks if input.Ref is equivalent to the resolved
hash, and runs `r.Fetch()` and checks out the branch for input.Ref
if it is different. `w.Pull()` can then pull the latest changes
before we checkout `*hash` again like normal

* Extract CloneIfRequired to reduce cyclomatic complexity

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-06-09 07:43:26 -07:00
Josh Soref
2097a3c017
Spelling (#240)
* spelling: cartesian

* spelling: deferring

* spelling: marshal
2020-05-18 09:53:42 -07:00
Máximo Cuadros
f6e37a8d67
*: update go-git import (#194) 2020-04-16 16:24:30 -07:00
Casey Lee
f5e67f2b86
fix #150 - disable dryrun in git clone 2020-03-14 00:13:18 -07:00
Casey Lee
e33606361f
tone down verbosity 2020-03-06 10:25:18 -08:00
Casey Lee
c32a87c6dc
fix #128: guard against empty actionName when 'uses: ./' (#130)
* fix #128: guard against empty actionName when 'uses: ./'

* fix #129 - force image name to be lowercase
2020-03-06 10:17:20 -08:00
Casey Lee
8696b42178
gofmt 2020-02-25 16:58:26 -08:00
Casey Lee
037e08a3a7
integration test 2020-02-24 12:48:12 -08:00
Casey Lee
01876438c2
shared container for job 2020-02-23 15:01:25 -08:00
Casey Lee
e371fa8c49
stop overwritting gitconfig
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:30 -05:00
Casey Lee
58731e8d9b
fixes #90 - hard reset when using a version for an action
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:28 -05:00
Casey Lee
f8fb88816a
matrix is done
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:03 -05:00
Casey Lee
5b7019cd0b
skip unsupported platforms
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:01 -05:00
Casey Lee
f7252cbcf9
add commands support
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:42 -05:00
Casey Lee
033168228b
cleanup logging
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:40 -05:00
Casey Lee
835b36cb63
ci tests
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:36 -05:00
Casey Lee
0582306861
unit tests
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:31 -05:00
Casey Lee
532af98aef
successfully able to run simple workflows
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:25 -05:00
Casey Lee
8c49ba0cec
initial load of yaml working 2020-02-04 16:38:41 -08:00