Skip to content

Commit

Permalink
Merge pull request #14 from lowply/change-template-path
Browse files Browse the repository at this point in the history
Change the template file path
  • Loading branch information
lowply authored Oct 18, 2022
2 parents 8c529a0 + 0012833 commit c72dcc4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Issue From Template

This action opens a new issue from an issue template. It parses the template's front matter and the body, then posts [an API request to open an issue](https://docs.github.com/en/rest/issues/issues#create-an-issue). Works best with a [scheduled workflow](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule) and the [Auto Closer](https://github.com/lowply/auto-closer) action.
This action opens a new issue from a markdown template file. It parses the template's front matter and the body, then posts [an API request to open an issue](https://docs.github.com/en/rest/issues/issues#create-an-issue). Works best with a [scheduled workflow](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule) and the [Auto Closer](https://github.com/lowply/auto-closer) action.

Note that "template" here is just a markdown file, not [GitHub's issue template feature](https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/about-issue-and-pull-request-templates) which uses yaml file.

## Environment variables

- `IFT_TEMPLATE_NAME` (*required*): The name of the issue template. For example, `report.md`. This action will look for the file in the `.github/ISSUE_TEMPLATE` directory.
- `IFT_TEMPLATE_NAME` (*required*): The name of the issue template. For example, `report.md`. This action will look for the template file in the `.github` directory. **Note that it will not look for any sub directories** including the `.github/ISSUE_TEMPLATE` directory.
- `ADD_DATES` (*optional*): Number of the dates to add. This is useful when you want to run this action to open an issue for the next week, not this week.

## Available template variables
Expand Down
2 changes: 1 addition & 1 deletion src/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ func NewIssue() *issue {
i.data = NewData(time.Now().AddDate(0, 0, dates))
}
i.endpoint = "https://api.github.com/repos/" + os.Getenv("GITHUB_REPOSITORY") + "/issues"
i.template = filepath.Join(os.Getenv("GITHUB_WORKSPACE"), ".github", "ISSUE_TEMPLATE", os.Getenv("IFT_TEMPLATE_NAME"))
i.template = filepath.Join(os.Getenv("GITHUB_WORKSPACE"), ".github", os.Getenv("IFT_TEMPLATE_NAME"))
return i
}

Expand Down

0 comments on commit c72dcc4

Please sign in to comment.