Skip to content

Commit

Permalink
adding ability to specify collections subfolders
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Mar 7, 2020
1 parent 0151419 commit 13a2753
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Critical items to know are:
- changed behaviour (recipe sections work differently)

## [master](https://github.com/rseng/good-first-issues/tree/master)
- add issue label and collection folder parameters (v1.0.2)
- ensure tags are sorted (v1.0.1)
- first tagged released associated with blog post (v1.0.0)

23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,13 @@ https://github.com/singularityhub/sregistry containers,singularity
However, you can change this by setting this variable to something else.


### `collection`

**optional** By default, the issues will each produce a markdown file to add to the "docs" GitHub pages folder,
in a subfolder named by this variable, which defaults to _issues. If you produce a site that has more
than one collection, you can change this to something else.


## Example usage

```yaml
Expand Down Expand Up @@ -60,6 +67,22 @@ Here is how you might update the label used:
token: ${{ secrets.GITHUB_TOKEN }}
```
Finally, if I want to instead output to a folder called `_another` (a Jekyll collection name)
as a relative path to the docs folder, I can set that as follows:


```yaml
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Generate First Issues
uses: rseng/[email protected]
with:
collection: '_another'
token: ${{ secrets.GITHUB_TOKEN }}
```


## Examples

- [awesome-rseng](https://github.com/rseng/awesome-rseng/blob/master/.github/workflows/generate-first-issues.yml) to generate first issues from the awesome-rseng repository, with repos listed in [.github/repos.txt](https://github.com/rseng/awesome-rseng/blob/master/.github/repos.txt)
Expand Down
5 changes: 5 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ inputs:
description: 'The relative path in the repository for the repos.txt'
required: true
default: 'repos.txt'
collection:
description: 'The relative path in docs for the collection folder to output to'
required: true
default: '_issues'
label:
description: 'The label to generate an interface for'
required: true
Expand All @@ -24,3 +28,4 @@ runs:
REPOS_FILE: ${{ inputs.repos-file }}
GITHUB_TOKEN: ${{ inputs.token }}
ISSUE_LABEL: ${{ inputs.label }}
COLLECTION_FOLDER: ${{ inputs.collection }}
8 changes: 7 additions & 1 deletion scripts/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@
set -eu
set -o pipefail

# Get the relative path of the folder in docs to write output
if [ -z "${COLLECTION_FOLDER}" ]; then
COLLECTION_FOLDER="_issues"
fi

# If the docs folder isn't created, do so.
if [ ! -d "/github/workspace/docs" ]; then
printf "Creating docs folder for GitHub pages\n"
Expand All @@ -11,7 +16,8 @@ fi

# Cleanup old set of first issues
printf "Cleaning up previous first issues...\n"
rm -rf /github/workspace/docs/_issues
rm -rf "/github/workspace/docs/${COLLECTION_FOLDER}"
export COLLECTION_FOLDER

# Generate first issues
python3 /generate-first-issues.py
7 changes: 6 additions & 1 deletion scripts/generate-first-issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# GitHub Workflow - we get variables from environment
REPOS_FILE = os.environ.get("REPOS_FILE")
ISSUE_LABEL = os.environ.get("ISSUE_LABEL", "good first issue")
COLLECTION_FOLDER = os.environ.get("COLLECTION_FOLDER", "_issues")
if not REPOS_FILE:
sys.exit(f"{REPOS_FILE} must be defined.")

Expand All @@ -30,7 +31,11 @@
data = {"state": "open", "labels": ISSUE_LABEL}

# Documentation base is located at docs
output_dir = "/github/workspace/docs/_issues"
output_dir = "/github/workspace/docs/%s" % COLLECTION_FOLDER

# Print metadata for user
print("Issue label: [%s]" % ISSUE_LABEL)
print("Collection output folder: [%s]" % output_dir)

if not os.path.exists(output_dir):
os.mkdir(output_dir)
Expand Down

0 comments on commit 13a2753

Please sign in to comment.