Commit Graph

107 Commits

Author SHA1 Message Date
Ryan 17652ce80e
Remove ubuntu-16.04 and add missing links for nix/go (#821)
* fix: remove ubuntu-16.04

* fix: add missing links for nix/go

* fix: remove specific platform versions
2021-09-22 19:43:58 +00:00
Ryan 5c841e22ab
Update docs, file formatting and docker images (#766)
* docs: fix wrong licence link

* fix: add more formatting settings, reformat all

feat: add vscode extensions recommendations

* docs: update contributing documentation

* fix: remove unnecessary comment

it was due to broken checkout

* docs: rework installation section

it has been brought up few times, new style should be easier
to understand

* docs: update images provided by catthehacker

* docs: replace 18.04 with recent image

* fix: add final new line
2021-08-09 09:07:26 -07:00
Ryan (hackercat) 1cf422e411
fix: warn Apple M1 (arm64) users (#743)
* fix: warn Apple M1 (arm64) users

* fix: missing dep

* fix: linting

* fix: linting (again)
2021-06-23 18:09:27 +00:00
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
Joseph Benden 003c995b36
Support container removal at exit. Fixes #694 (#714)
This patch adds a new command-line flag (`--rm`) to automatically
stop workflow container(s), just prior to exit. The default
behavior is kept, e.g.: the containers continue running at exit.

Fixes: #694
Signed-off-by: Joseph Benden <joe@benden.us>

Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2021-06-10 15:09:05 +00:00
Joseph Benden 6b4d359737
Add support for container kernel capabilities (#716)
This patch adds two new command-line flags to specify one or
more kernel capabilities to add or remove from the workflow
containers.

The command-line flag `--container-cap-add` allows for adding
specific capabilities on the workflow containers; where as,

The command-line flag `--container-cap-drop` allows for removing
specific capabilities on the workflow containers.

This was developed to specifically be able to add `SYS_PTRACE`
to a workflow I maintain. It involves using this capability to
monitor a make build, to then build a compilation database.

Signed-off-by: Joseph Benden <joe@benden.us>
2021-06-04 16:06:59 +00:00
Ryan (hackercat) 799098b0e6
feat: add option for custom socket path (#698) 2021-05-23 14:43:09 +00:00
Torbjørn Vatn 92eec3a526
$GITHUB_PATH support (#566)
* Regression in the .golangci.yml file

* This looks like an even better fix to #451

The previous solution only prevented the `starting container process caused "exec: \"bash\"`
error when someone added an "extra" path in the workflow using `::add-path`

* Add support for >> $GITHUB_PATH

* The newRunCommand has too high cyclomatic complexity

* Add "linux/arm64" to new test

* The cyclop linter was complaining so I extracted some funcs

* Close some readers

* Fix typo

* fix: add missing composite function

* Fix regress from merging

* Keep the error messages as is

* consolidate with master

* Close the tar reader on defer

* New way to get ContainerWorkdir

* Remove arch from runner test

* Separate the UpdateFromEnv and UpdateFromPath

Co-authored-by: hackercat <me@hackerc.at>
2021-05-06 13:30:12 +00: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) 806bc4d999
refactor: `NewWorkflowPlanner` (#648)
feat: add flag `--no-recurse` to disable recursion when reading workflows from directories
feat: added more tests to `TestPlanner`, renamed `TestJobFileInfo` to more appropriate name `WorkflowPlanTest`
style: changed error message to lowercase, added single quotes for better visibility

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-05-03 07:57:24 -07:00
Ryan (hackercat) 7ae9916de0
Add option to allow files/directories in `.gitignore` to be copied to container (#537)
* disable gitignore for actions

* feat: Add option to allow/disallow paths specified in .gitignore

Co-authored-by: Alan Birtles <alan.birtles@eu.sony.com>
2021-05-03 07:37:20 -07:00
Ryan (hackercat) f32babb51d
fix: reworked container architecture (#619)
- Don't set architecture, let Docker host decide it's own platform,
  remove `runtime` dependency and don't show default in `--help`
- Remove most tests, we need to check only once if it works on
  different platform
- Rename `DeleteImage` to `RemoveImage` to conform to existing
  function in `docker` cli, added options to specify `force` and
  `pruneChildren`
2021-05-02 08:15:13 -07:00
hackercat 4125812a63
Refactor `.actrc` locations and default image survey (#600)
* refactor: move survey/cfgs into own funcs, read XDG base dirs for config

Moved actrc locations to own func since it can be reused.
Moved survey part to own func due to high cyclomatic complexity.
Added XDG config dir to config locations.
Replaced using HOME envvar with go-homedir module since it's already
an indirect dependency and handles home directories better
for each GOOS.

* refactor: use `go-homedir`, check if XDG var is not empty
2021-04-05 08:51:13 -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
Jay Pipes d67e282f68
use container image platform only on docker 1.41+ (#591)
Commit af5140f13e introduced support for
specifying a container image platform for cross-platform image building.

Unfortunately, attempting to execute a docker command that includes the
`--platform` flag against Docker daemons using API Version 1.40 and
before results in the following error:

```
"specify container image platform" requires API version 1.41, but the Docker daemon API version is 1.40
```

To allow `act` to be used on the 19.03 Docker CE and earlier versions,
this patch simply checks the Docker daemon API version and only
specifies platform specification when the daemon API version is 1.41 or
greater.

Fixes Issue #586
2021-03-30 10:10:42 -07:00
hackercat 780a8a061c
fix: use new platforms after survey, check working dir for `.actrc` (#577) 2021-03-29 07:58:00 -07:00
hackercat 72f2d2de51
fix: update `ubuntu-latest` to point to `ubuntu-20.04` (#580)
GitHub Actions switched `ubuntu-latest` to `ubuntu-20.04`
Ref:
  https://github.com/actions/virtual-environments/issues/1816
  https://github.com/actions/virtual-environments/pull/2852
2021-03-28 21:47:07 -07:00
hackercat 6c258cf40d
Add option to run custom architecture (container platform) (#525)
* Add QEMU to run different architectures

* Update dependencies in `go.mod`

* Add `--container-architecture` flag to specify custom image architecture

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-03-28 21:08:40 -07:00
Hibariya 8de7b956b7
Add --userns flag to support Docker daemon that enables user namespace (#533)
I got an error like this after hitting `act` command.

> Error: Error response from daemon: cannot share the host's network namespace when user namespaces are enabled

According to the document, when user namespaces are enabled on the Docker daemon,
neither host network mode and --privileged work without --userns=host. Since `act`
uses host network mode to match GitHub Actions runners, it cannot run jobs when
user namespaces are enabled. So I added the flag.

https://docs.docker.com/engine/security/userns-remap/#user-namespace-known-limitations

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-02-27 08:31:25 -08:00
hackercat 34dc2dc15c
Update Docker images (#524) 2021-02-23 09:49:24 -08:00
Cat™ fc46f506e3
Update `README.md`/`cmd/root.go` with additional information (#523)
* Update README

* Add notice about large image, add link to repo for `.actrc`
2021-02-08 09:12:57 -08:00
Owen Young 22d56c3517
fix: --version, --help do not need check platform config (#508) 2021-01-29 06:40:13 -08:00
Cat™ b424a785e3
Load .secrets file as default (#488)
* Load .secrets file as default

* Update README
2021-01-19 06:31:46 -08:00
Cat™ 6130460c40
Add survey during first run for a default image (#483)
* Add survey during first run for a default image

* few minor formatting updates

* Use image from DockerHub

Co-authored-by: Casey Lee <cplee@nektos.com>
2021-01-19 06:30:17 -08:00
Cat™ 9bbf35e88e
Add autodetect event flag (#486)
* Add autodetect event flag

* Add new flag to README.md

* Make help more clear
2021-01-18 11:42:55 -08:00
Cat™ 41692c314d
Add --env flag to pass environment vars without file (#474) 2021-01-14 21:26:01 -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
Cat™ 80a245652e
Add option to disable hiding of secrets (#460) 2021-01-11 22:28:45 -08:00
lshamis 644bc2b635
Simpler list view (#382)
* Simpler list view

* lint

* readding graph viz with -g/--graph

Co-authored-by: Leonid Shamis <lshamis@bob.localdomain>
Co-authored-by: Casey Lee <cplee@nektos.com>
2020-10-12 10:26:22 -07:00
Tom Lazar 7d443c6520
Set the default branch inside the event data (#354)
* set ${{github.event.repository.default_branch}}

* change `ok == false` to `!ok`

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-09-02 07:56:44 -07:00
whywaita 24bdb024bf
add flag of privileged mode 2020-08-02 05:21:49 +09:00
Strajk 4864ece107 Document `secret-file` in README and add example 2020-07-21 10:10:23 +02:00
Dylan Arbour 69b8802ab3 Change -W command to accept a single file
Currently setting workflows with the -W (--workflows) flag only accepts
a folder. It is not possible to run a single workflow.yml file.

This commit allows either a single file or a directory to be passed into
the workflows flag.
2020-05-26 23:29:50 -04:00
Michael Heap a5e86bd024
Add support for changing the GITHUB_ACTOR (#229)
This adds the `-a` flag when running `act` to change the username of the GITHUB_ACTOR environment variable

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-05-12 00:14:56 -07:00
jony montana 2f395475b0
feat: load every environment from --env-file to workflow (#184)
* feat: load every environment from --env-file to workflow

* fix: pass dotenv's environments through by context

* updates to support --secret-file

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-04-17 10:04:40 -07:00
Aidan Steele fea9a8afa5
Use “push” event workflow(s) if defined (closes #156) (#157) 2020-03-15 22:29:13 -07:00
Casey Lee 4fde7d8865
fix #121 and #123 - add support for reading env variables from .env (#133) 2020-03-06 12:30:24 -08:00
Steffen Schmitz 4f84be12e3
fix #117 - handle whitespace in actrc secrets (#118)
* fix #117 - handle whitespace in actrc secrets

* Switch to raw string on regex pattern

Co-authored-by: Casey Lee <cplee@nektos.com>
2020-03-02 08:11:46 -08:00
Casey Lee 76a8bfc4fc
fix #89 - support .actrc file 2020-02-24 22:11:33 -08:00
Casey Lee 1121f6e132
run with copy of workingdir 2020-02-24 17:48:21 -08:00
Casey Lee 3d3fc59dbe
update for platforms
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:18 -05:00
Casey Lee 543501a36a
add support to override platform
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:15 -05:00
Casey Lee 573f78e1b4
support for secrets
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:06:09 -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 64562d41ab
test updates
Signed-off-by: Casey Lee <cplee@nektos.com>
2020-02-20 21:05:44 -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 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
Marc Campbell 7fadbdb6e8 Add flag to skip pulling images already present 2019-02-18 21:12:35 -08:00
Dan Sosedoff 96065fe807 Detect workflow event type 2019-02-15 10:34:19 -06:00
Casey Lee 2e52ef61c8
feedback from PR on --watch 2019-02-12 23:35:04 -05:00
Jesse Newland 3198627879 --watch 2019-02-09 20:39:09 -06:00
Casey Lee 8793c8a6a4
add support for 'reuse' mode to allow act to be used for a fast local task runner 2019-01-17 14:53:35 -08:00
Casey Lee 317a305f51
refactor actions to improve testability 2019-01-17 14:53:35 -08:00
Casey Lee c573d9d48a
fix #7 - allow passing a custom event.json to be populated in the container filesystem 2019-01-16 13:11:32 -08:00
Casey Lee f683af5954
Initial commit with support for GitHub actions 2019-01-12 20:45:25 -08:00