Skip to content
This repository has been archived by the owner on Feb 22, 2023. It is now read-only.
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: WordPress/openverse-api
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 2ac52a42fb850547d88395a8595c8b542f4bd87b
Choose a base ref
..
head repository: WordPress/openverse-api
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: bad1118dd0b059d20c0d987967d64fedef7d7963
Choose a head ref
7 changes: 7 additions & 0 deletions .github/auto-label.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"rules": {
"migrations": [
"**/migrations/**/*"
]
}
}
29 changes: 20 additions & 9 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: CI + CD

on:
pull_request:
push:
@@ -15,16 +16,25 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Rebase
if: github.event.input.rebase
run: |
git fetch main
git rebase main
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: Cache pre-commit envs
uses: actions/cache@v2
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}

- name: Run pre-commit to lint files
run: |
pip install pre-commit
@@ -40,7 +50,7 @@ jobs:
- ingestion_server
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v1
@@ -71,7 +81,7 @@ jobs:
- build-images
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup just
uses: extractions/setup-just@v1
@@ -125,7 +135,8 @@ jobs:
- build-images
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup just
uses: extractions/setup-just@v1

@@ -169,7 +180,7 @@ jobs:
- build-images
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup just
uses: extractions/setup-just@v1
@@ -194,7 +205,7 @@ jobs:
- build-images
steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup just
uses: extractions/setup-just@v1
@@ -210,7 +221,7 @@ jobs:
docker load --input /tmp/ingestion_server/ingestion_server.tar
- name: Run makemigrations
run: just dj makemigrations --check --noinput
run: just dj makemigrations --check --noinput --merge

push:
name: Publish Docker images
@@ -262,7 +273,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup just
uses: extractions/setup-just@v1
@@ -335,7 +346,7 @@ jobs:
(This comment will be automatically updated with the preview URLs once it is ready)
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

- name: Setup just
uses: extractions/setup-just@v1
41 changes: 41 additions & 0 deletions .github/workflows/migration_safety_warning.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: "Migration Safety Check"

on:
pull_request:
paths:
- "**/migrations/**/*"

jobs:
check-and-apply-labels:
name: "Check and Apply Labels"
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3

- uses: peter-evans/find-comment@v2
id: existing-warning
with:
issue-number: ${{ github.event.pull_request.number }}
body-includes: This PR has migrations

- uses: actions/github-script@v6
if: steps.existing-warning.outputs.comment-id != 0
with:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
await github.rest.issues.deleteComment({
owner: 'WordPress',
repo: 'openverse-api',
comment_id: ${{ steps.existing-warning.outputs.comment-id }},
})
- uses: peter-evans/create-or-update-comment@v2
with:
issue-number: ${{ github.event.pull_request.number }}
body: |
This PR has migrations. Please rebase it before merging to ensure that conflicting migrations are not introduced.
- uses: banyan/auto-label@1.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<img src="https://github.com/WordPress/openverse/raw/main/brand/banner.svg" width="100%"/>

<p align="center">
<a href="https://github.com/orgs/WordPress/projects/3">Project Board</a> | <a href="https://make.wordpress.org/openverse/">Community Site</a> | <a href="https://make.wordpress.org/chat/">#openverse @ Slack</a> | <a href="https://make.wordpress.org/openverse/handbook/openverse-handbook/">Handbook</a> | <a href="https://www.figma.com/file/w60dl1XPUvSaRncv1Utmnb/Openverse-Releases">Figma Mockups</a> | <a href="https://www.figma.com/file/GIIQ4sDbaToCfFQyKMvzr8/Openverse-Design-Library">Figma Design Library</a>
<a href="https://github.com/orgs/WordPress/projects/3">Project Board</a> | <a href="https://make.wordpress.org/openverse/">Community Site</a> | <a href="https://make.wordpress.org/chat/">#openverse @ Slack</a> | <a href="https://make.wordpress.org/openverse/handbook/">Handbook</a> | <a href="https://www.figma.com/file/w60dl1XPUvSaRncv1Utmnb/Openverse-Releases">Figma Mockups</a> | <a href="https://www.figma.com/file/GIIQ4sDbaToCfFQyKMvzr8/Openverse-Design-Library">Figma Design Library</a>
</p>

# Openverse API
2 changes: 1 addition & 1 deletion api/Pipfile
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ fakeredis = "*"
aws-requests-auth = "*"
boto3 = "*"
deepdiff = "*"
Django = "==4.0.6"
Django = "==4.0.7"
django-braces = "*"
django-cors-headers = "*"
django-oauth-toolkit = "==2.1.0"
76 changes: 30 additions & 46 deletions api/Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions api/catalog/api/utils/throttle.py
Original file line number Diff line number Diff line change
@@ -53,6 +53,10 @@ class SustainedRateThrottle(AbstractAnonRateThrottle):
scope = "anon_sustained"


class AnonThumbnailRateThrottle(AbstractAnonRateThrottle):
scope = "anon_thumbnail"


class TenPerDay(AbstractAnonRateThrottle):
rate = "10/day"

@@ -90,6 +94,11 @@ def get_cache_key(self, request, view):
return self.cache_format % {"scope": self.scope, "ident": ident}


class OAuth2IdThumbnailRateThrottle(AbstractOAuth2IdRateThrottle):
applies_to_rate_limit_model = "standard"
scope = "oauth2_client_credentials_thumbnail"


class OAuth2IdSustainedRateThrottle(AbstractOAuth2IdRateThrottle):
applies_to_rate_limit_model = "standard"
scope = "oauth2_client_credentials_sustained"
Loading