Skip to content

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

Move automations into their own directory; update README (#201)

Zack Krida51305023a47d
diff --git a/.github/workflows/label_pr.yml b/.github/workflows/label_pr.yml
index a1bb29c13..156e76a97 100644
--- a/.github/workflows/label_pr.yml
+++ b/.github/workflows/label_pr.yml
@@ -23,14 +23,14 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- working-directory: ./python
+ working-directory: ./automations/python
run: |
python -m pip install --user --upgrade pip
python -m pip install --user pipenv
pipenv install --deploy
- name: Label PR
- working-directory: ./python
+ working-directory: ./automations/python
run: |
pipenv run python label_pr.py \
--pr-url $PR_URL
diff --git a/.github/workflows/label_sync.yml b/.github/workflows/label_sync.yml
index e1989a128..8b170d53b 100644
--- a/.github/workflows/label_sync.yml
+++ b/.github/workflows/label_sync.yml
@@ -24,13 +24,13 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- working-directory: ./python
+ working-directory: ./automations/python
run: |
python -m pip install --user --upgrade pip
python -m pip install --user pipenv
pipenv install --deploy
- name: Sync standard labels
- working-directory: ./python
+ working-directory: ./automations/python
run: |
pipenv run python sync_labels.py
diff --git a/.github/workflows/pr_project_automation.yml b/.github/workflows/pr_project_automation.yml
index 507353e97..3a5565259 100644
--- a/.github/workflows/pr_project_automation.yml
+++ b/.github/workflows/pr_project_automation.yml
@@ -23,21 +23,21 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- working-directory: ./python
+ working-directory: ./automations/python
run: |
python -m pip install --user --upgrade pip
python -m pip install --user pipenv
pipenv install --deploy
- name: Clear PRs in "Merged!"
- working-directory: ./python
+ working-directory: ./automations/python
run: |
pipenv run python archive_column.py \
--project-number 8 \
--column 'Merged!'
- name: Clear PRs in "Closed"
- working-directory: ./python
+ working-directory: ./automations/python
run: |
pipenv run python archive_column.py \
--project-number 8 \
diff --git a/.github/workflows/project_automation.yml b/.github/workflows/project_automation.yml
index 668727ba6..66ac6f860 100644
--- a/.github/workflows/project_automation.yml
+++ b/.github/workflows/project_automation.yml
@@ -24,14 +24,14 @@ jobs:
python-version: "3.10"
- name: Install dependencies
- working-directory: ./python
+ working-directory: ./automations/python
run: |
python -m pip install --user --upgrade pip
python -m pip install --user pipenv
pipenv install --deploy
- name: Move issues from "To do"
- working-directory: ./python
+ working-directory: ./automations/python
run: |
pipenv run python issues_with_prs.py \
--project-number 3 \
@@ -39,7 +39,7 @@ jobs:
--target-column "In progress"
- name: Move issues from "Backlog"
- working-directory: ./python
+ working-directory: ./automations/python
run: |
pipenv run python issues_with_prs.py \
--project-number 3 \
diff --git a/.github/workflows/weekly_updates.yml b/.github/workflows/weekly_updates.yml
index 871568795..ae0c42324 100644
--- a/.github/workflows/weekly_updates.yml
+++ b/.github/workflows/weekly_updates.yml
@@ -25,9 +25,9 @@ jobs:
node-version: 14
- name: Install dependencies
- working-directory: ./js
+ working-directory: ./automations/js
run: npm ci
- name: Create draft post
- working-directory: ./js
+ working-directory: ./automations/js
run: node src/last_week_tonight.js
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index 7bf30da03..e3bb46cf6 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -44,9 +44,11 @@ repos:
rev: 3.9.2
hooks:
- id: flake8
+ args:
+ - --config=automations/.flake8
- repo: https://github.com/ambv/black
- rev: 21.6b0
+ rev: 22.3.0
hooks:
- id: black
args:
diff --git a/README.md b/README.md
index 5416cb5a2..b5038088b 100644
--- a/README.md
+++ b/README.md
@@ -54,12 +54,12 @@ to the project with our
## Repository structure
-- **`python/`:** This directory contains scripts written in Python.
- - Use this as the working directory when executing Python scripts.
- - Requires [Pipenv](https://pipenv.pypa.io) as the package manager.
-
-- **`js/`:** This directory contains scripts written in JavaScript.
- - Use this as the working directory when executing JavaScript scripts.
- - Requires [npm](https://www.npmjs.com) as the package manager.
-
+- **`automations/`:** This directory contains scripts related to project management or one-off tasks.
+ - **`python/`:** This directory contains scripts written in Python.
+ - Use this as the working directory when executing Python scripts.
+ - Requires [Pipenv](https://pipenv.pypa.io) as the package manager.
+ - **`js/`:** This directory contains scripts written in JavaScript.
+ - Use this as the working directory when executing JavaScript scripts.
+ - 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.
diff --git a/.flake8 b/automations/.flake8
similarity index 100%
rename from .flake8
rename to automations/.flake8
diff --git a/automations/README.md b/automations/README.md
new file mode 100644
index 000000000..687fc37ed
--- /dev/null
+++ b/automations/README.md
@@ -0,0 +1,14 @@
+# Automations
+
+This directory contains automations for managing the Openverse repositories and Developer Experience.
+
+## Requirements
+
+- Node v14
+ - This should be kept in sync between the GitHub Actions `node-version` and the `volta.node` key in the `package.json` file.
+- Python 3.10
+- [Just](https://github.com/casey/just) command runner
+
+## Installing Dependencies
+
+Run `just install` to set up Python and JavaScript dependencies.
diff --git a/data/github.yml b/automations/data/github.yml
similarity index 100%
rename from data/github.yml
rename to automations/data/github.yml
diff --git a/data/labels.yml b/automations/data/labels.yml
similarity index 100%
rename from data/labels.yml
rename to automations/data/labels.yml
diff --git a/js/.eslintrc.js b/automations/js/.eslintrc.js
similarity index 100%
rename from js/.eslintrc.js
rename to automations/js/.eslintrc.js
diff --git a/js/.gitignore b/automations/js/.gitignore
similarity index 100%
rename from js/.gitignore
rename to automations/js/.gitignore
diff --git a/js/package-lock.json b/automations/js/package-lock.json
similarity index 100%
rename from js/package-lock.json
rename to automations/js/package-lock.json
diff --git a/js/package.json b/automations/js/package.json
similarity index 73%
rename from js/package.json
rename to automations/js/package.json
index 4b294af56..b3bfb68d1 100644
--- a/js/package.json
+++ b/automations/js/package.json
@@ -3,5 +3,8 @@
"@octokit/rest": "^18.9.0",
"js-yaml": "^4.1.0",
"node-fetch": "^2.6.7"
+ },
+ "volta": {
+ "node": "14.19.1"
}
}
diff --git a/js/prettier.config.js b/automations/js/prettier.config.js
similarity index 100%
rename from js/prettier.config.js
rename to automations/js/prettier.config.js
diff --git a/js/src/last_week_tonight.js b/automations/js/src/last_week_tonight.js
similarity index 100%
rename from js/src/last_week_tonight.js
rename to automations/js/src/last_week_tonight.js
diff --git a/js/src/migrate_issues.js b/automations/js/src/migrate_issues.js
similarity index 100%
rename from js/src/migrate_issues.js
rename to automations/js/src/migrate_issues.js
diff --git a/js/src/utils.js b/automations/js/src/utils.js
similarity index 100%
rename from js/src/utils.js
rename to automations/js/src/utils.js
diff --git a/js/src/weekly_report.js b/automations/js/src/weekly_report.js
similarity index 100%
rename from js/src/weekly_report.js
rename to automations/js/src/weekly_report.js
diff --git a/python/.gitignore b/automations/python/.gitignore
similarity index 100%
rename from python/.gitignore
rename to automations/python/.gitignore
diff --git a/python/Pipfile b/automations/python/Pipfile
similarity index 100%
rename from python/Pipfile
rename to automations/python/Pipfile
diff --git a/python/Pipfile.lock b/automations/python/Pipfile.lock
similarity index 100%
rename from python/Pipfile.lock
rename to automations/python/Pipfile.lock
diff --git a/python/README.md b/automations/python/README.md
similarity index 100%
rename from python/README.md
rename to automations/python/README.md
diff --git a/python/archive_column.py b/automations/python/archive_column.py
similarity index 100%
rename from python/archive_column.py
rename to automations/python/archive_column.py
diff --git a/python/issues_with_prs.py b/automations/python/issues_with_prs.py
similarity index 100%
rename from python/issues_with_prs.py
rename to automations/python/issues_with_prs.py
diff --git a/python/label_pr.py b/automations/python/label_pr.py
similarity index 100%
rename from python/label_pr.py
rename to automations/python/label_pr.py
diff --git a/python/models/__init__.py b/automations/python/models/__init__.py
similarity index 100%
rename from python/models/__init__.py
rename to automations/python/models/__init__.py
diff --git a/python/models/label.py b/automations/python/models/label.py
similarity index 100%
rename from python/models/label.py
rename to automations/python/models/label.py
diff --git a/python/models/label_group.py b/automations/python/models/label_group.py
similarity index 100%
rename from python/models/label_group.py
rename to automations/python/models/label_group.py
diff --git a/python/shared/__init__.py b/automations/python/shared/__init__.py
similarity index 100%
rename from python/shared/__init__.py
rename to automations/python/shared/__init__.py
diff --git a/python/shared/data.py b/automations/python/shared/data.py
similarity index 100%
rename from python/shared/data.py
rename to automations/python/shared/data.py
diff --git a/python/shared/github.py b/automations/python/shared/github.py
similarity index 100%
rename from python/shared/github.py
rename to automations/python/shared/github.py
diff --git a/python/shared/log.py b/automations/python/shared/log.py
similarity index 100%
rename from python/shared/log.py
rename to automations/python/shared/log.py
diff --git a/python/shared/project.py b/automations/python/shared/project.py
similarity index 100%
rename from python/shared/project.py
rename to automations/python/shared/project.py
diff --git a/python/sync_labels.py b/automations/python/sync_labels.py
similarity index 100%
rename from python/sync_labels.py
rename to automations/python/sync_labels.py
diff --git a/justfile b/justfile
index 5f4e080a4..b90a73735 100644
--- a/justfile
+++ b/justfile
@@ -8,18 +8,18 @@ default:
# Dev #
#######
-# Install Python dependencies in Pipenv environments
+# Install Python dependencies in Pipenv environments and JS dependencies
@install:
just _py-install
just _js-install
# Setup pre-commit as a Git hook
precommit:
- cd python && pipenv run pre-commit install
+ cd automations/python && pipenv run pre-commit install
# Run pre-commit to lint and reformat all files
lint:
- cd python && pipenv run pre-commit run --all-files
+ cd automations/python && pipenv run pre-commit run --all-files
##########
# Python #
@@ -27,7 +27,7 @@ lint:
# Install dependencies for Python
_py-install:
- cd python && pipenv install --dev
+ cd automations/python && pipenv install --dev
##############
# JavaScript #
@@ -35,4 +35,4 @@ _py-install:
# Install dependencies for JavaScript
_js-install:
- cd js && npm install
+ cd automations/js && npm install