actiondoc 0.1.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.dockerignore +1 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/actiondoc.gemspec +1 -1
- data/lib/actiondoc/generator.rb +60 -10
- data/lib/actiondoc/version.rb +1 -1
- data/lib/actiondoc.rb +15 -12
- data/templates/README.md.erb +83 -5
- metadata +5 -11
- data/.github/workflows/README.md.no-template +0 -13
- data/.github/workflows/README.md.with-template +0 -48
- data/.github/workflows/action-tests.yml +0 -42
- data/.github/workflows/docker-build.yml +0 -46
- data/.github/workflows/generate-readme.yml +0 -27
- data/.github/workflows/tests.yml +0 -49
- data/lib/actiondoc/templates/default.erb +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e3c58562841476b25f7b28ff0773199fbfceff01c050793e0b4f8b37ae0b9fad
|
4
|
+
data.tar.gz: 9e73c913a023a357e09ed9cae8f4af10c89ee32c68e9c779194bd5d30a7ac78c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdee99862d92e906e4d1f90d848374948edb0da86efc21be6adc5a7203ab253d496af9889b38af41a189e6ac044e0e2d9d37dfd97afb25b1c853f5c0da6320ba
|
7
|
+
data.tar.gz: 2224a87cac9fc2c8332adcc4e37bf22bf574702b3f3e5f66362a7ed85fdff5af40fe09fd68ac4a42bbc0252d4b912a1786c2600f24bc8c0f587fd0085da47836
|
data/.dockerignore
CHANGED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,74 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, gender identity and expression, level of experience,
|
9
|
+
nationality, personal appearance, race, religion, or sexual identity and
|
10
|
+
orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at aisrael@gmail.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at [https://contributor-covenant.org/version/1/4][version]
|
72
|
+
|
73
|
+
[homepage]: https://contributor-covenant.org
|
74
|
+
[version]: https://contributor-covenant.org/version/1/4/
|
data/actiondoc.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.description = 'Ruby Gem to generate documentation for GitHub Actions'
|
16
16
|
spec.homepage = 'https://github.com/aisrael/actiondoc'
|
17
17
|
spec.license = 'MIT'
|
18
|
-
spec.required_ruby_version = Gem::Requirement.new('~> 2.
|
18
|
+
spec.required_ruby_version = Gem::Requirement.new('~> 3.2.2')
|
19
19
|
|
20
20
|
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
21
21
|
|
data/lib/actiondoc/generator.rb
CHANGED
@@ -6,7 +6,25 @@ require 'ostruct'
|
|
6
6
|
require 'table_layouts'
|
7
7
|
require 'yaml'
|
8
8
|
|
9
|
-
|
9
|
+
DEFAULT_TEMPLATE = <<~ERB
|
10
|
+
<%= action.name %>
|
11
|
+
====
|
12
|
+
|
13
|
+
<%= action.description %>
|
14
|
+
|
15
|
+
<%= inputs_section -%>
|
16
|
+
ERB
|
17
|
+
|
18
|
+
TEMPLATE_WITHOUT_INPUTS = <<~ERB
|
19
|
+
<%= action.name %>
|
20
|
+
====
|
21
|
+
|
22
|
+
<%= action.description %>
|
23
|
+
|
24
|
+
## Inputs
|
25
|
+
|
26
|
+
This action has no inputs.
|
27
|
+
ERB
|
10
28
|
|
11
29
|
module ActionDoc
|
12
30
|
# The documentation generator class
|
@@ -21,33 +39,58 @@ module ActionDoc
|
|
21
39
|
end
|
22
40
|
|
23
41
|
def run
|
42
|
+
check_action_yml
|
24
43
|
action = read_action_yml
|
25
|
-
|
26
|
-
render_template(
|
44
|
+
template = read_template(action)
|
45
|
+
render_template(template, action)
|
46
|
+
end
|
47
|
+
|
48
|
+
def read_template(action)
|
49
|
+
options_template = options[:template]
|
50
|
+
if options_template
|
51
|
+
unless File.readable?(options_template)
|
52
|
+
warn "Template file #{options_template} not found! Aborting..."
|
53
|
+
exit 1
|
54
|
+
end
|
55
|
+
ERB.new(File.read(options_template), trim_mode: '-')
|
56
|
+
elsif action.inputs && !action.inputs.empty?
|
57
|
+
ERB.new(DEFAULT_TEMPLATE, trim_mode: '-')
|
58
|
+
else
|
59
|
+
ERB.new(TEMPLATE_WITHOUT_INPUTS, trim_mode: '-')
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def check_action_yml
|
64
|
+
@path_to_action_yml = @args.first || 'action.yml'
|
65
|
+
return if File.readable?(@path_to_action_yml)
|
66
|
+
|
67
|
+
warn "#{@path_to_action_yml} not found! Aborting..."
|
68
|
+
exit 1
|
27
69
|
end
|
28
70
|
|
29
71
|
def read_action_yml
|
30
|
-
yaml = YAML.safe_load(File.read(
|
72
|
+
yaml = YAML.safe_load(File.read(@path_to_action_yml)).deep_symbolize_keys
|
31
73
|
inputs = yaml.fetch(:inputs, {}).map do |k, v|
|
32
|
-
Input.new(k, v[:description], v[:required] ? 'Required' : 'No', v[:default])
|
74
|
+
Input.new(k, v[:description].chomp, v[:required] ? 'Required' : 'No', v[:default])
|
33
75
|
end
|
34
|
-
Action.new(
|
76
|
+
Action.new(yaml[:name], yaml[:description].chomp, inputs)
|
35
77
|
end
|
36
78
|
|
37
|
-
def render_template(
|
79
|
+
def render_template(template, action)
|
38
80
|
inputs_table = construct_inputs_table(action)
|
39
|
-
template = ERB.new(File.read(template_filename), trim_mode: '-')
|
40
81
|
model = TemplateModel.new(action, inputs_table)
|
41
82
|
puts template.result(model.instance_eval { binding })
|
42
83
|
end
|
43
84
|
|
44
85
|
def construct_inputs_table(action)
|
86
|
+
return unless action.inputs && !action.inputs.empty?
|
87
|
+
|
45
88
|
TableLayouts::Nice.new(Input.members_as_headers, action.inputs).layout
|
46
89
|
end
|
47
90
|
end
|
48
91
|
|
92
|
+
# For ERB binding
|
49
93
|
INPUTS_SECTION_ERB = <<~ERB
|
50
|
-
|
51
94
|
## Inputs
|
52
95
|
|
53
96
|
<% inputs_table.each do |row| -%>
|
@@ -55,10 +98,17 @@ module ActionDoc
|
|
55
98
|
<% end -%>
|
56
99
|
ERB
|
57
100
|
|
101
|
+
NO_INPUTS = <<~NO_INPUTS
|
102
|
+
|
103
|
+
## Inputs
|
104
|
+
|
105
|
+
This action has no inputs.
|
106
|
+
NO_INPUTS
|
107
|
+
|
58
108
|
# For ERB binding
|
59
109
|
TemplateModel = Struct.new(:action, :inputs_table) do
|
60
110
|
def inputs_section
|
61
|
-
return if inputs_table.nil? || inputs_table.empty?
|
111
|
+
return NO_INPUTS if inputs_table.nil? || inputs_table.empty?
|
62
112
|
|
63
113
|
ERB.new(INPUTS_SECTION_ERB, trim_mode: '-').result(binding)
|
64
114
|
end
|
data/lib/actiondoc/version.rb
CHANGED
data/lib/actiondoc.rb
CHANGED
@@ -13,11 +13,7 @@ module ActionDoc
|
|
13
13
|
def run
|
14
14
|
options = parse_options
|
15
15
|
|
16
|
-
|
17
|
-
display_version
|
18
|
-
else
|
19
|
-
ActionDoc::Generator.new(ARGV, options).run
|
20
|
-
end
|
16
|
+
ActionDoc::Generator.new(ARGV, options).run
|
21
17
|
end
|
22
18
|
|
23
19
|
# Builds the OptionParser and parses the options
|
@@ -39,23 +35,30 @@ module ActionDoc
|
|
39
35
|
# Builds and returns the OptionParser
|
40
36
|
def build_optparser(options)
|
41
37
|
OptionParser.new do |opts|
|
42
|
-
opts.banner =
|
38
|
+
opts.banner = <<~BANNER
|
39
|
+
Usage:
|
40
|
+
|
41
|
+
actiondoc [options] [ACTION_YAML_FILE]
|
42
|
+
|
43
|
+
Where:
|
44
|
+
[ACTION_YAML_FILE] is the path to the action.yaml file. Defaults to "action.yaml"
|
45
|
+
in the current directory.
|
46
|
+
|
47
|
+
Options:
|
48
|
+
BANNER
|
43
49
|
|
44
50
|
opts.on('--template=TEMPLATE_FILENAME', '-t=TEMPLATE_FILENAME', 'The template to use') do |template_filename|
|
45
51
|
options[:template] = template_filename
|
46
52
|
end
|
47
53
|
opts.on('--version', 'Show the version') do
|
48
|
-
|
54
|
+
puts "actiondoc v#{ActionDoc::VERSION}"
|
55
|
+
exit
|
49
56
|
end
|
50
57
|
opts.on('--help', 'Display this help text') do
|
51
58
|
puts opts
|
59
|
+
exit
|
52
60
|
end
|
53
61
|
end
|
54
62
|
end
|
55
|
-
|
56
|
-
# Print out the version (in the VERSION file)
|
57
|
-
def display_version
|
58
|
-
puts "actiondoc v#{ActionDoc::VERSION}"
|
59
|
-
end
|
60
63
|
end
|
61
64
|
end
|
data/templates/README.md.erb
CHANGED
@@ -4,9 +4,13 @@
|
|
4
4
|
[![Tests](https://github.com/aisrael/actiondoc/actions/workflows/tests.yml/badge.svg)](https://github.com/aisrael/actiondoc/actions/workflows/tests.yml)
|
5
5
|
|
6
6
|
<%= action.description %>
|
7
|
+
|
7
8
|
<%= inputs_section -%>
|
8
9
|
|
9
|
-
|
10
|
+
actiondoc is both a Ruby Gem _and_ a GitHub Action that uses that gem to generate a suitable `README.md` from
|
11
|
+
an optional ERB template, intended to help keep your own action's documentation up-to-date with the actual inputs.
|
12
|
+
|
13
|
+
See [Basic Usage](features/basic_usage.feature) for some basic usage of the gem.
|
10
14
|
|
11
15
|
### Example
|
12
16
|
|
@@ -20,7 +24,7 @@ name: actiondoc
|
|
20
24
|
inputs:
|
21
25
|
path-to-action-yml:
|
22
26
|
description: >-
|
23
|
-
The path to the `action.yml` file
|
27
|
+
The path to the `action.yml` file
|
24
28
|
required: false
|
25
29
|
```
|
26
30
|
|
@@ -34,7 +38,81 @@ Generates documentation from your GitHub Action's `action.yml`
|
|
34
38
|
|
35
39
|
## Inputs
|
36
40
|
|
37
|
-
| Name | Description
|
38
|
-
|
39
|
-
| path-to-action-yml | The path to the `action.yml` file
|
41
|
+
| Name | Description | Required | Default |
|
42
|
+
|--------------------|-----------------------------------|----------|---------|
|
43
|
+
| path-to-action-yml | The path to the `action.yml` file | No | |
|
44
|
+
```
|
45
|
+
|
46
|
+
## Use it in a workflow to update your action's README
|
47
|
+
|
48
|
+
### Commit & push directly to update the README.md
|
49
|
+
|
50
|
+
The following sample workflow uses this repository as a GitHub Action directly, and commits the updated
|
51
|
+
README.md directly.
|
52
|
+
|
53
|
+
|
54
|
+
```yaml
|
55
|
+
name: Generate README
|
56
|
+
on:
|
57
|
+
push:
|
58
|
+
paths:
|
59
|
+
- action.yml
|
60
|
+
- README.md.erb
|
61
|
+
|
62
|
+
jobs:
|
63
|
+
generate-readme:
|
64
|
+
runs-on: ubuntu-latest
|
65
|
+
steps:
|
66
|
+
- uses: actions/checkout@v3
|
67
|
+
- run: if [ -f README.md ]; then rm README.md; fi
|
68
|
+
- name: Generate README
|
69
|
+
uses: aisrael/actiondoc@v1
|
70
|
+
with:
|
71
|
+
template-filename: README.md.erb
|
72
|
+
output-filename: README.md
|
73
|
+
- run: |
|
74
|
+
cat README.md
|
75
|
+
- name: Commit & Push changes
|
76
|
+
uses: actions-js/push@master
|
77
|
+
with:
|
78
|
+
github_token: ${{ secrets.GITHUB_TOKEN }}
|
79
|
+
```
|
80
|
+
|
81
|
+
|
82
|
+
### Create a PR to update the README.md
|
83
|
+
|
84
|
+
The following sample workflow uses this repository as a GitHub Action directly, and creates a PR (using
|
85
|
+
[peter-evans/create-pull-request](https://github.com/peter-evans/create-pull-request)) to
|
86
|
+
update `README.md` on any changes to either `action.yml` or `README.md.erb`.
|
87
|
+
|
88
|
+
|
89
|
+
```yaml
|
90
|
+
name: Generate README
|
91
|
+
on:
|
92
|
+
push:
|
93
|
+
paths:
|
94
|
+
- action.yml
|
95
|
+
- README.md.erb
|
96
|
+
|
97
|
+
jobs:
|
98
|
+
generate-readme:
|
99
|
+
runs-on: ubuntu-latest
|
100
|
+
steps:
|
101
|
+
- uses: actions/checkout@v3
|
102
|
+
- run: if [ -f README.md ]; then rm README.md; fi
|
103
|
+
- name: Generate README
|
104
|
+
uses: aisrael/actiondoc@v1
|
105
|
+
with:
|
106
|
+
template-filename: README.md.erb
|
107
|
+
output-filename: README.md
|
108
|
+
- run: |
|
109
|
+
cat README.md
|
110
|
+
- name: Create Pull Request
|
111
|
+
uses: peter-evans/create-pull-request@v4
|
112
|
+
with:
|
113
|
+
add-paths: README.md
|
114
|
+
base: main
|
115
|
+
branch: update-readme
|
116
|
+
delete-branch: true
|
117
|
+
title: Update README.md
|
40
118
|
```
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actiondoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alistair Israel
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -131,12 +131,7 @@ extensions: []
|
|
131
131
|
extra_rdoc_files: []
|
132
132
|
files:
|
133
133
|
- ".dockerignore"
|
134
|
-
-
|
135
|
-
- ".github/workflows/README.md.with-template"
|
136
|
-
- ".github/workflows/action-tests.yml"
|
137
|
-
- ".github/workflows/docker-build.yml"
|
138
|
-
- ".github/workflows/generate-readme.yml"
|
139
|
-
- ".github/workflows/tests.yml"
|
134
|
+
- CODE_OF_CONDUCT.md
|
140
135
|
- Gemfile
|
141
136
|
- LICENSE
|
142
137
|
- actiondoc.gemspec
|
@@ -144,7 +139,6 @@ files:
|
|
144
139
|
- lib/action.rb
|
145
140
|
- lib/actiondoc.rb
|
146
141
|
- lib/actiondoc/generator.rb
|
147
|
-
- lib/actiondoc/templates/default.erb
|
148
142
|
- lib/actiondoc/version.rb
|
149
143
|
- lib/table_layouts.rb
|
150
144
|
- templates/README.md.erb
|
@@ -164,14 +158,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
158
|
requirements:
|
165
159
|
- - "~>"
|
166
160
|
- !ruby/object:Gem::Version
|
167
|
-
version: 2.
|
161
|
+
version: 3.2.2
|
168
162
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
163
|
requirements:
|
170
164
|
- - ">="
|
171
165
|
- !ruby/object:Gem::Version
|
172
166
|
version: '0'
|
173
167
|
requirements: []
|
174
|
-
rubygems_version: 3.
|
168
|
+
rubygems_version: 3.4.10
|
175
169
|
signing_key:
|
176
170
|
specification_version: 4
|
177
171
|
summary: Generate documentation for GitHub Actions
|
@@ -1,13 +0,0 @@
|
|
1
|
-
actiondoc
|
2
|
-
====
|
3
|
-
|
4
|
-
Generates documentation from your GitHub Action's `action.yml`
|
5
|
-
|
6
|
-
## Inputs
|
7
|
-
|
8
|
-
| Name | Description | Required | Default |
|
9
|
-
|--------------------|-----------------------------------------------------------------------------------------|----------|---------|
|
10
|
-
| template-filename | The path to the ERB template to use to generate the documentation. | No | |
|
11
|
-
| output-filename | The filename to save the output to. If not specified, simply prints to standard output. | No | |
|
12
|
-
| path-to-action-yml | The path to the `action.yml` file to generate documentation for. | No | |
|
13
|
-
| working-directory | The directory to perform the action in, if not $GITHUB_WORKSPACE | No | |
|
@@ -1,48 +0,0 @@
|
|
1
|
-
actiondoc
|
2
|
-
====
|
3
|
-
|
4
|
-
[![Tests](https://github.com/aisrael/actiondoc/actions/workflows/tests.yml/badge.svg)](https://github.com/aisrael/actiondoc/actions/workflows/tests.yml)
|
5
|
-
|
6
|
-
Generates documentation from your GitHub Action's `action.yml`
|
7
|
-
|
8
|
-
## Inputs
|
9
|
-
|
10
|
-
| Name | Description | Required | Default |
|
11
|
-
|--------------------|-----------------------------------------------------------------------------------------|----------|---------|
|
12
|
-
| template-filename | The path to the ERB template to use to generate the documentation. | No | |
|
13
|
-
| output-filename | The filename to save the output to. If not specified, simply prints to standard output. | No | |
|
14
|
-
| path-to-action-yml | The path to the `action.yml` file to generate documentation for. | No | |
|
15
|
-
| working-directory | The directory to perform the action in, if not $GITHUB_WORKSPACE | No | |
|
16
|
-
|
17
|
-
See [Basic Usage](features/basic_usage.feature) for some basic usage.
|
18
|
-
|
19
|
-
### Example
|
20
|
-
|
21
|
-
Given an `action.yml` that contains:
|
22
|
-
|
23
|
-
```yaml
|
24
|
-
name: actiondoc
|
25
|
-
description: >-
|
26
|
-
Generates documentation from your GitHub Action's `action.yml`
|
27
|
-
|
28
|
-
inputs:
|
29
|
-
path-to-action-yml:
|
30
|
-
description: >-
|
31
|
-
The path to the `action.yml` file to generate documentation for.
|
32
|
-
required: false
|
33
|
-
```
|
34
|
-
|
35
|
-
Then when running `actiondoc` it should output
|
36
|
-
|
37
|
-
```markdown
|
38
|
-
actiondoc
|
39
|
-
====
|
40
|
-
|
41
|
-
Generates documentation from your GitHub Action's `action.yml`
|
42
|
-
|
43
|
-
## Inputs
|
44
|
-
|
45
|
-
| Name | Description | Required | Default |
|
46
|
-
|--------------------|------------------------------------------------------------------|----------|---------|
|
47
|
-
| path-to-action-yml | The path to the `action.yml` file to generate documentation for. | No | |
|
48
|
-
```
|
@@ -1,42 +0,0 @@
|
|
1
|
-
name: Action Tests
|
2
|
-
on: push
|
3
|
-
|
4
|
-
jobs:
|
5
|
-
test-with-defaults:
|
6
|
-
runs-on: ubuntu-latest
|
7
|
-
steps:
|
8
|
-
- uses: actions/checkout@v3
|
9
|
-
- run: |
|
10
|
-
ls -l .
|
11
|
-
- name: Given
|
12
|
-
run: if [ -f README.md ]; then rm README.md; fi
|
13
|
-
- name: Test with defaults
|
14
|
-
uses: ./.
|
15
|
-
with:
|
16
|
-
output-filename: README.md
|
17
|
-
- run: |
|
18
|
-
ls -l .
|
19
|
-
- name: Assertions
|
20
|
-
run: |
|
21
|
-
cat README.md
|
22
|
-
[ -f README.md ] && diff README.md .github/workflows/README.md.no-template
|
23
|
-
|
24
|
-
test-with-template:
|
25
|
-
runs-on: ubuntu-latest
|
26
|
-
steps:
|
27
|
-
- uses: actions/checkout@v3
|
28
|
-
- run: |
|
29
|
-
ls -l .
|
30
|
-
- name: Given
|
31
|
-
run: if [ -f README.md ]; then rm README.md; fi
|
32
|
-
- name: Test with defaults
|
33
|
-
uses: ./.
|
34
|
-
with:
|
35
|
-
template-filename: templates/README.md.erb
|
36
|
-
output-filename: README.md
|
37
|
-
- run: |
|
38
|
-
ls -l .
|
39
|
-
- name: Assertions
|
40
|
-
run: |
|
41
|
-
cat README.md
|
42
|
-
[ -f README.md ] && diff README.md .github/workflows/README.md.with-template
|
@@ -1,46 +0,0 @@
|
|
1
|
-
name: Build Docker Image
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
branches:
|
5
|
-
- main
|
6
|
-
paths:
|
7
|
-
- "!.github/workflows/**"
|
8
|
-
- .github/workflows/docker-build.yml
|
9
|
-
- "lib/**"
|
10
|
-
- "exe/**"
|
11
|
-
- actiondoc.gemspec
|
12
|
-
- Dockerfile
|
13
|
-
- Gemfile
|
14
|
-
- Rakefile
|
15
|
-
|
16
|
-
jobs:
|
17
|
-
docker-build:
|
18
|
-
runs-on: ubuntu-latest
|
19
|
-
steps:
|
20
|
-
- uses: actions/checkout@v3
|
21
|
-
- name: Set up Docker Buildx
|
22
|
-
uses: docker/setup-buildx-action@v2
|
23
|
-
# So now you can use Actions' own caching!
|
24
|
-
- name: Cache Docker layers
|
25
|
-
uses: actions/cache@v3
|
26
|
-
with:
|
27
|
-
path: /tmp/.buildx-cache
|
28
|
-
key: ${{ runner.os }}-buildx-${{ inputs.git-hash || github.sha }}
|
29
|
-
restore-keys: |
|
30
|
-
${{ runner.os }}-buildx-
|
31
|
-
- name: Login to GitHub Container Registry
|
32
|
-
uses: docker/login-action@v2
|
33
|
-
with:
|
34
|
-
registry: ghcr.io
|
35
|
-
username: ${{ github.repository_owner }}
|
36
|
-
password: ${{ secrets.GITHUB_TOKEN }}
|
37
|
-
- run: |
|
38
|
-
rake build
|
39
|
-
- name: Build and push
|
40
|
-
uses: docker/build-push-action@v3
|
41
|
-
with:
|
42
|
-
context: .
|
43
|
-
push: true
|
44
|
-
tags: |
|
45
|
-
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:latest
|
46
|
-
ghcr.io/${{ github.repository_owner }}/${{ github.event.repository.name }}:0.1.0
|
@@ -1,27 +0,0 @@
|
|
1
|
-
name: Generate README
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
paths:
|
5
|
-
- action.yml
|
6
|
-
- templates/**
|
7
|
-
|
8
|
-
jobs:
|
9
|
-
generate-readme:
|
10
|
-
runs-on: ubuntu-latest
|
11
|
-
steps:
|
12
|
-
- uses: actions/checkout@v3
|
13
|
-
- run: if [ -f README.md ]; then rm README.md; fi
|
14
|
-
- name: Test with defaults
|
15
|
-
uses: ./.
|
16
|
-
with:
|
17
|
-
template-filename: templates/README.md.erb
|
18
|
-
output-filename: README.md
|
19
|
-
- run: |
|
20
|
-
cat README.md
|
21
|
-
- name: Create Pull Request
|
22
|
-
uses: peter-evans/create-pull-request@v4
|
23
|
-
with:
|
24
|
-
add-paths: README.md
|
25
|
-
branch: update-readme
|
26
|
-
delete-branch: true
|
27
|
-
title: Update README.md
|
data/.github/workflows/tests.yml
DELETED
@@ -1,49 +0,0 @@
|
|
1
|
-
name: Rubocop and Tests
|
2
|
-
on:
|
3
|
-
push:
|
4
|
-
paths-ignore:
|
5
|
-
- README.md
|
6
|
-
pull_request:
|
7
|
-
branches:
|
8
|
-
- main
|
9
|
-
|
10
|
-
jobs:
|
11
|
-
rubocop:
|
12
|
-
name: Rubocop
|
13
|
-
runs-on: ubuntu-latest
|
14
|
-
steps:
|
15
|
-
- name: Checkout Code
|
16
|
-
uses: actions/checkout@v3
|
17
|
-
- name: Set up Ruby
|
18
|
-
uses: ruby/setup-ruby@v1
|
19
|
-
with:
|
20
|
-
# runs 'bundle install' and caches installed gems automatically
|
21
|
-
bundler-cache: true
|
22
|
-
- name: Run RuboCop
|
23
|
-
run: bundle exec rubocop --parallel
|
24
|
-
|
25
|
-
unit-tests:
|
26
|
-
name: Unit tests
|
27
|
-
runs-on: ubuntu-latest
|
28
|
-
steps:
|
29
|
-
- name: Checkout Code
|
30
|
-
uses: actions/checkout@v3
|
31
|
-
- name: Set up Ruby
|
32
|
-
uses: ruby/setup-ruby@v1
|
33
|
-
with:
|
34
|
-
bundler-cache: true
|
35
|
-
- name: Run the tests
|
36
|
-
run: bundle exec rake test
|
37
|
-
|
38
|
-
cucumber-tests:
|
39
|
-
name: Cucumber tests
|
40
|
-
runs-on: ubuntu-latest
|
41
|
-
steps:
|
42
|
-
- name: Checkout Code
|
43
|
-
uses: actions/checkout@v3
|
44
|
-
- name: Set up Ruby
|
45
|
-
uses: ruby/setup-ruby@v1
|
46
|
-
with:
|
47
|
-
bundler-cache: true
|
48
|
-
- name: Run the tests
|
49
|
-
run: bundle exec cucumber
|