Skip to content

Commit

Permalink
Updated to parse arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackton1 committed Sep 27, 2021
1 parent 6e09134 commit 8156f11
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 21 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

.DEFAULT_GOAL := help

PATHS := README.md

.PHONY: help
# Put it first so that "make" without argument is like "make help".
help:
Expand All @@ -20,5 +22,5 @@ build: ## Compile go modules
.PHONY: run
run: build ## Execute binary
@echo "Executing binary..."
@./auto_doc
@./auto_doc $(PATHS)
@$(MAKE) clean
8 changes: 0 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Action auto doc generator
description: Action auto doc generator
author: jackton1
inputs:
token:
description: 'GITHUB_TOKEN or a repo scoped PAT'
required: true
default: ${{ github.token }}
files:
description: 'Input file(s)'
required: true
Expand All @@ -27,15 +23,11 @@ runs:
${{ runner.os }}-go-
- run: |
bash $GITHUB_ACTION_PATH/entrypoint.sh
bash $GITHUB_ACTION_PATH/cleanup.sh
id: auto-doc
shell: bash
env:
GITHUB_BASE_REF: ${{ github.base_ref }}
GITHUB_REPOSITORY: ${{ github.repository }}
# INPUT_<VARIABLE_NAME> is not available in Composite run steps
# https://github.community/t/input-variable-name-is-not-available-in-composite-run-steps/127611
INPUT_TOKEN: ${{ inputs.token }}
INPUT_FILES: ${{ inputs.files }}
branding:
icon: file-text
Expand Down
5 changes: 0 additions & 5 deletions cleanup.sh

This file was deleted.

4 changes: 3 additions & 1 deletion cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ var rootCmd = &cobra.Command{
Short: "Auto doc generator for your github action",
Long: `Auto generate documentation for your github action.`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Printf("working")
for _, path := range args {
fmt.Printf("working on %s \n", path)
}
},
}

Expand Down
7 changes: 1 addition & 6 deletions entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,4 @@

set -e

make build

for path in ${INPUT_FILES}
do
./auto_doc "$path"
done
make run PATHS="${INPUT_FILES}"

0 comments on commit 8156f11

Please sign in to comment.