Skip to content

Commit

Permalink
exposing variable as an envar
Browse files Browse the repository at this point in the history
Signed-off-by: vsoch <[email protected]>
  • Loading branch information
vsoch committed Mar 5, 2020
1 parent fe637cb commit 0151419
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 5 deletions.
23 changes: 20 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,39 @@ https://github.com/spack/spack hpc,package-management
https://github.com/singularityhub/sregistry containers,singularity
```

### `label`

**optional** By default, the repository will filter down to issues labeled with "good first issue".
However, you can change this by setting this variable to something else.


## Example usage

```yaml
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Generate First Issues
uses: rseng/[email protected].1
uses: rseng/[email protected].2
with:
repos-file: '.github/repos.txt'
token: ${{ secrets.GITHUB_TOKEN }}
```
You only need to define repos-file if you change the path (note that the above is changed from .github/repos.txt). It's
highly recommended that you don't use master branch, but instead
a version release or commit (as shown above).
highly recommended that you don't use master branch, but instead a version release or commit (as shown above).
Here is how you might update the label used:
```yaml
steps:
- name: Checkout Code
uses: actions/checkout@v2
- name: Generate First Issues
uses: rseng/[email protected]
with:
label: 'bug'
token: ${{ secrets.GITHUB_TOKEN }}
```
## Examples
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'
label:
description: 'The label to generate an interface for'
required: true
default: 'good first issue'
token:
description: >
Auth token used to fetch the repository.
Expand All @@ -19,3 +23,4 @@ runs:
env:
REPOS_FILE: ${{ inputs.repos-file }}
GITHUB_TOKEN: ${{ inputs.token }}
ISSUE_LABEL: ${{ inputs.label }}
5 changes: 3 additions & 2 deletions scripts/generate-first-issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,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")
if not REPOS_FILE:
sys.exit(f"{REPOS_FILE} must be defined.")

Expand All @@ -26,7 +27,7 @@

# Must authenticate
headers = {"Authorization": f"token {token}"}
data = {"state": "open", "labels": "good first issue"}
data = {"state": "open", "labels": ISSUE_LABEL}

# Documentation base is located at docs
output_dir = "/github/workspace/docs/_issues"
Expand Down Expand Up @@ -60,7 +61,7 @@

# Add labels as tags
tags = set([x["name"] for x in issue["labels"]])
tags.remove("good first issue")
tags.remove(ISSUE_LABEL)
tags = list(tags)

if extra_tags:
Expand Down

0 comments on commit 0151419

Please sign in to comment.