Skip to content

Openverse is a search engine for openly-licensed media. This monorepo includes all application code.

Render per-repo pull request template (#356)

Madison Swain-Bowdend0f068ff34e8
diff --git a/.github/sync.yml b/.github/sync.yml
index 99418c037..7bbb856c0 100644
--- a/.github/sync.yml
+++ b/.github/sync.yml
@@ -38,38 +38,51 @@ group:
dest: .github/release_drafter.yml
- source: .github/ISSUE_TEMPLATE/
dest: .github/ISSUE_TEMPLATE/
- - source: .github/PULL_REQUEST_TEMPLATE.md
- dest: .github/PULL_REQUEST_TEMPLATE.md
# Unified lint rules
- repos: |
WordPress/openverse
WordPress/openverse-catalog
WordPress/openverse-api
files:
- - source: prettier.config.js.jinja
+ - source: templates/prettier.config.js.jinja
dest: prettier.config.js
template: true
- repos: |
WordPress/openverse
files:
- - source: .pre-commit-config.local.yaml.jinja
+ - source: templates/.pre-commit-config.local.yaml.jinja
dest: .pre-commit-config.yaml
template: true
- repos: |
WordPress/openverse-catalog
WordPress/openverse-api
files:
- - source: .pre-commit-config.yaml.jinja
+ - source: templates/.pre-commit-config.yaml.jinja
dest: .pre-commit-config.yaml
template:
contains_js_code: false
- repos: |
WordPress/openverse-frontend
files:
- - source: .pre-commit-config.frontend.yaml.jinja
+ - source: templates/.pre-commit-config.frontend.yaml.jinja
dest: .pre-commit-config.yaml
template:
contains_python_code: false
- - source: prettier.config.frontend.js.jinja
+ - source: templates/prettier.config.frontend.js.jinja
dest: prettier.config.js
template: true
+ # Pull request configuration
+ - repos: |
+ WordPress/openverse
+ WordPress/openverse-frontend
+ WordPress/openverse-api
+ files:
+ - source: templates/PULL_REQUEST_TEMPLATE.md.jinja
+ dest: .github/PULL_REQUEST_TEMPLATE.md
+ template: true
+ - repos: |
+ WordPress/openverse-catalog
+ files:
+ - source: templates/PULL_REQUEST_TEMPLATE.catalog.md.jinja
+ dest: .github/PULL_REQUEST_TEMPLATE.md
+ template: true
diff --git a/.pre-commit-config.local.yaml.jinja b/.pre-commit-config.local.yaml.jinja
deleted file mode 100644
index 39287cb69..000000000
--- a/.pre-commit-config.local.yaml.jinja
+++ /dev/null
@@ -1,23 +0,0 @@
-{% extends '.pre-commit-config.yaml.jinja' %}
-
-{% block note %}
-{{ super() }}
-# - https://github.com/WordPress/openverse/blob/main/.pre-commit-config.local.yaml.jinja
-{%- endblock %}
-
-{% block repos_bottom %}
-{# This comment adds a blank line. #}
- - repo: local
- hooks:
- - id: render-precommit
- name: render-precommit
- entry: bash -c 'just render-precommit'
- language: system
- pass_filenames: false
-
- - id: render-prettier
- name: render-prettier
- entry: bash -c 'just render-prettier'
- language: system
- pass_filenames: false
-{% endblock %}
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 082731776..691b63c26 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -1,7 +1,7 @@
# This file is being synced from WordPress/openverse. Any changes made to it
# here will be overwritten. Please make any necessary edits to these files:
# - https://github.com/WordPress/openverse/blob/main/.pre-commit-config.yaml.jinja
-# - https://github.com/WordPress/openverse/blob/main/.pre-commit-config.local.yaml.jinja
+# - https://github.com/WordPress/openverse/blob/main/templates/.pre-commit-config.local.yaml.jinja
exclude: Pipfile\.lock|migrations|\.idea|node_modules|archive
@@ -97,9 +97,13 @@ repos:
entry: bash -c 'just render-precommit'
language: system
pass_filenames: false
-
- id: render-prettier
name: render-prettier
entry: bash -c 'just render-prettier'
language: system
pass_filenames: false
+ - id: render-github
+ name: render-github
+ entry: bash -c 'just render-github'
+ language: system
+ pass_filenames: false
diff --git a/README.md b/README.md
index 782c5b50b..73df8c158 100644
--- a/README.md
+++ b/README.md
@@ -66,3 +66,5 @@ felt it best to keep them distinct.
- Requires [npm](https://www.npmjs.com) as the package manager.
- **`brand/`:** This directory contains brand assets for the project.
- **`rfcs/`:** This directory contains proposals for changes to Openverse.
+- **`templates/`:** This directory contains templates which are rendered by
+ GitHub and synced across the other repositories.
diff --git a/justfile b/justfile
index 010b3838d..d58494501 100644
--- a/justfile
+++ b/justfile
@@ -44,8 +44,12 @@ render in_file out_file ctx="{}":
# Render `.pre-commit-config.yaml`
render-precommit:
- just render .pre-commit-config.local.yaml.jinja .pre-commit-config.yaml
+ just render templates/.pre-commit-config.local.yaml.jinja .pre-commit-config.yaml
# Render `prettier.config.js`
render-prettier:
- just render prettier.config.js.jinja prettier.config.js
+ just render templates/prettier.config.js.jinja prettier.config.js
+
+# Render GitHub issue & PR templates
+render-github:
+ just render templates/PULL_REQUEST_TEMPLATE.md.jinja .github/PULL_REQUEST_TEMPLATE.md
diff --git a/.pre-commit-config.frontend.yaml.jinja b/templates/.pre-commit-config.frontend.yaml.jinja
similarity index 93%
rename from .pre-commit-config.frontend.yaml.jinja
rename to templates/.pre-commit-config.frontend.yaml.jinja
index e85846c3b..805a1bf80 100644
--- a/.pre-commit-config.frontend.yaml.jinja
+++ b/templates/.pre-commit-config.frontend.yaml.jinja
@@ -1,11 +1,11 @@
{% set eslint_files = '\\.(js|ts|vue)$' %}
{% set eslint_exclude = '^nuxt-template-overrides/.*$' %}
-{% extends '.pre-commit-config.yaml.jinja' %}
+{% extends 'templates/.pre-commit-config.yaml.jinja' %}
{% block note %}
{{ super() }}
-# - https://github.com/WordPress/openverse/blob/main/.pre-commit-config.frontend.yaml.jinja
+# - https://github.com/WordPress/openverse/blob/main/templates/.pre-commit-config.frontend.yaml.jinja
{%- endblock %}
{#=======================================
diff --git a/templates/.pre-commit-config.local.yaml.jinja b/templates/.pre-commit-config.local.yaml.jinja
new file mode 100644
index 000000000..7d63fd58d
--- /dev/null
+++ b/templates/.pre-commit-config.local.yaml.jinja
@@ -0,0 +1,20 @@
+{% extends 'templates/.pre-commit-config.yaml.jinja' %}
+
+{% block note %}
+{{ super() }}
+# - https://github.com/WordPress/openverse/blob/main/templates/.pre-commit-config.local.yaml.jinja
+{%- endblock %}
+
+{% block repos_bottom %}
+{# This comment adds a blank line. #}
+ - repo: local
+ hooks:
+ {% set renders = ["precommit", "prettier", "github"] %}
+ {% for render in renders %}
+ - id: render-{{ render }}
+ name: render-{{ render }}
+ entry: bash -c 'just render-{{ render }}'
+ language: system
+ pass_filenames: false
+ {% endfor %}
+{% endblock %}
diff --git a/.pre-commit-config.yaml.jinja b/templates/.pre-commit-config.yaml.jinja
similarity index 100%
rename from .pre-commit-config.yaml.jinja
rename to templates/.pre-commit-config.yaml.jinja
diff --git a/templates/PULL_REQUEST_TEMPLATE.catalog.md.jinja b/templates/PULL_REQUEST_TEMPLATE.catalog.md.jinja
new file mode 100644
index 000000000..4511af973
--- /dev/null
+++ b/templates/PULL_REQUEST_TEMPLATE.catalog.md.jinja
@@ -0,0 +1,5 @@
+{% extends 'templates/PULL_REQUEST_TEMPLATE.md.jinja' %}
+
+{% block additional_checks %}
+- [ ] I ran the DAG documentation generator (if applicable).
+{% endblock %}
diff --git a/templates/PULL_REQUEST_TEMPLATE.md.jinja b/templates/PULL_REQUEST_TEMPLATE.md.jinja
new file mode 100644
index 000000000..c779919e2
--- /dev/null
+++ b/templates/PULL_REQUEST_TEMPLATE.md.jinja
@@ -0,0 +1,87 @@
+## Fixes
+
+<!-- If PR doesn't fully resolve the issue, replace 'Fixes' below with 'Related to'. -->
+<!-- If there is no issue being resolved, please consider opening one before creating this pull request. -->
+
+Fixes #[issue number] by @[issue author]
+
+## Description
+
+<!-- Concisely describe what the pull request does. -->
+<!-- Add screenshots, videos, or other media to show the problem and the solution when appropriate. -->
+
+## Testing Instructions
+
+<!-- Give steps for the reviewer to verify that this PR fixes the problem; or delete this section entirely. -->
+
+{% block additional_sections %}
+{% endblock -%}
+
+## Checklist
+
+<!-- Replace the [ ] with [x] to check the boxes. -->
+
+- [ ] My pull request has a descriptive title (not a vague title like
+ `Update index.md`).
+- [ ] My pull request targets the _default_ branch of the repository (`main`) or
+ a parent feature branch.
+- [ ] My commit messages follow [best practices][best_practices].
+- [ ] My code follows the established code style of the repository.
+- [ ] I added or updated tests for the changes I made (if applicable).
+- [ ] I added or updated documentation (if applicable).
+- [ ] I tried running the project locally and verified that there are no visible
+ errors.
+{% block additional_checks %}
+{% endblock %}
+
+[best_practices]:
+ https://git-scm.com/book/en/v2/Distributed-Git-Contributing-to-a-Project#_commit_guidelines
+
+## Developer Certificate of Origin
+
+<!-- You must read and understand the following attestation. -->
+
+<details>
+<summary>Developer Certificate of Origin</summary>
+
+```
+Developer Certificate of Origin
+Version 1.1
+
+Copyright (C) 2004, 2006 The Linux Foundation and its contributors.
+1 Letterman Drive
+Suite D4700
+San Francisco, CA, 94129
+
+Everyone is permitted to copy and distribute verbatim copies of this
+license document, but changing it is not allowed.
+
+
+Developer's Certificate of Origin 1.1
+
+By making a contribution to this project, I certify that:
+
+(a) The contribution was created in whole or in part by me and I
+ have the right to submit it under the open source license
+ indicated in the file; or
+
+(b) The contribution is based upon previous work that, to the best
+ of my knowledge, is covered under an appropriate open source
+ license and I have the right under that license to submit that
+ work with modifications, whether created in whole or in part
+ by me, under the same open source license (unless I am
+ permitted to submit under a different license), as indicated
+ in the file; or
+
+(c) The contribution was provided directly to me by some other
+ person who certified (a), (b) or (c) and I have not modified
+ it.
+
+(d) I understand and agree that this project and the contribution
+ are public and that a record of the contribution (including all
+ personal information I submit with it, including my sign-off) is
+ maintained indefinitely and may be redistributed consistent with
+ this project or the open source license(s) involved.
+```
+
+</details>
diff --git a/prettier.config.frontend.js.jinja b/templates/prettier.config.frontend.js.jinja
similarity index 59%
rename from prettier.config.frontend.js.jinja
rename to templates/prettier.config.frontend.js.jinja
index 50852b703..0aa4638f4 100644
--- a/prettier.config.frontend.js.jinja
+++ b/templates/prettier.config.frontend.js.jinja
@@ -1,8 +1,8 @@
-{% extends 'prettier.config.js.jinja' %}
+{% extends 'templates/prettier.config.js.jinja' %}
{% block note %}
{{ super() }}
-// - https://github.com/WordPress/openverse/blob/main/prettier.config.frontend.js.jinja
+// - https://github.com/WordPress/openverse/blob/main/templates/prettier.config.frontend.js.jinja
{%- endblock %}
{% block additional_config %}
diff --git a/prettier.config.js.jinja b/templates/prettier.config.js.jinja
similarity index 100%
rename from prettier.config.js.jinja
rename to templates/prettier.config.js.jinja