-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor template rendering and automated issue creation (#113)
- Loading branch information
Showing
12 changed files
with
135 additions
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: publish-from-template | ||
description: "Publish information from a template" | ||
|
||
inputs: | ||
filename: | ||
description: Path to issue template. Usually in .github/issue-templates | ||
required: true | ||
|
||
runs: | ||
using: composite | ||
|
||
steps: | ||
- name: Render template | ||
shell: bash | ||
env: ${{ env }} | ||
run: | ||
python .github/actions/publish-from-template/render_template.py ${{ | ||
inputs.filename }} | ||
|
||
- uses: JasonEtco/create-an-issue@v2.6.0 | ||
if: github.event_name == 'schedule' | ||
env: ${{ env }} | ||
with: | ||
filename: ${{ inputs.filename }} | ||
update_existing: false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import os | ||
import pathlib | ||
import sys | ||
|
||
import jinja2 | ||
|
||
|
||
def main(template_path): | ||
loader = jinja2.FileSystemLoader(searchpath=template_path.parent) | ||
env = jinja2.Environment(loader=loader) | ||
template = env.get_template(template_path.name) | ||
print(template.render(env=os.environ)) | ||
|
||
|
||
if __name__ == "__main__": | ||
template_path = pathlib.Path(sys.argv[1]) | ||
main(template_path) |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
--- | ||
title: `light-the-torch` is out of sync with the PyTorch package indices | ||
assignees: pmeier | ||
--- | ||
{%- if env.MISSING|length %} | ||
The following packages are available, but not patched: | ||
{% for package in env.MISSING.split(",") %} | ||
- `{{ package }}` | ||
{%- endfor %} | ||
{%- endif %} | ||
{% if env.EXTRA|length %} | ||
The following packages are patched, but not available: | ||
{% for package in env.EXTRA.split(",") %} | ||
- `{{ package }}` | ||
{%- endfor %} | ||
{%- endif %} |
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: check-available-pytorch-dists | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- .github/issue-templates/packages-out-of-sync.md | ||
- .github/workflows/check-available-pytorch-dists.yml | ||
- scripts/check_pytorch_package_indices.py | ||
|
||
schedule: | ||
- cron: "0 4 * * *" | ||
|
||
jobs: | ||
check: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: Setup development environment | ||
uses: ./.github/actions/setup-dev-env | ||
|
||
- name: Check available packages on PyTorch indices | ||
id: packages | ||
run: | | ||
OUT=$(python scripts/check_pytorch_package_indices.py) | ||
MISSING=$(echo $OUT | jq -r '.missing | join(",")') | ||
echo "missing=${MISSING}" >> $GITHUB_OUTPUT | ||
EXTRA=$(echo $OUT | jq -r '.extra | join(",")') | ||
echo "extra=${EXTRA}" >> $GITHUB_OUTPUT | ||
[ -z "${MISSING}${EXTRA}" ]; | ||
- if: failure() | ||
name: Publish information from template | ||
uses: ./.github/actions/publish-from-template | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
MISSING: ${{ steps.packages.outputs.missing }} | ||
EXTRA: ${{ steps.packages.outputs.extra }} | ||
with: | ||
filename: .github/issue-templates/packages-out-of-sync.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.github/issue-templates |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,3 +14,4 @@ check-wheel-contents | |
requests | ||
beautifulsoup4 | ||
jinja2 | ||
tqdm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters