Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/WordPress/openverse into mo…
Browse files Browse the repository at this point in the history
…d_metrics
  • Loading branch information
dhruvkb committed Feb 11, 2024
2 parents 8db2a01 + 6f5a10b commit 8192a5d
Show file tree
Hide file tree
Showing 178 changed files with 2,665 additions and 1,058 deletions.
1 change: 1 addition & 0 deletions .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ tsconfig.base.json @WordPress/openverse-frontend

# Specific assignments for the 'openverse-maintainers' group
.codespell/ @WordPress/openverse-maintainers
.vale/ @WordPress/openverse-maintainers
.devcontainer/ @WordPress/openverse-maintainers
.github/ @WordPress/openverse-maintainers
automations/ @WordPress/openverse-maintainers
Expand Down
1 change: 1 addition & 0 deletions .github/filters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ lint:
- .pre-commit-config.yaml
- tsconfig.base.json
- .codespell
- .vale
mgmt:
- .github/**
- .devcontainer/**
Expand Down
17 changes: 15 additions & 2 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,19 @@ jobs:
just precommit
just lint
validate-codeowners:
name: Validate CODEOWNERS
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- uses: mszostok/[email protected]
with:
checks: "files,duppatterns,syntax"
experimental_checks: "notowned,avoid-shadowing"

add-stack-label:
name: Add stack label
if: |
Expand Down Expand Up @@ -219,7 +232,7 @@ jobs:
uses: docker/build-push-action@v5
with:
context: ${{ matrix.context }}
target: ${{ matrix.target }}
target: ${{ matrix.target || '' }}
push: false
tags: openverse-${{ matrix.image }}
file: ${{ matrix.file }}
Expand Down Expand Up @@ -1107,7 +1120,7 @@ jobs:
run: python generate_report.py

- name: Send report
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
payload: ${{ steps.report.outputs.payload }}
env:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/discussion_ping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,15 @@ jobs:
env:
discussion_url: ${{ github.event.discussion.html_url }}
discussion_number: ${{ github.event.discussion.number }}
discussion_title: ${{ toJSON(github.event.discussion.title) }}
discussion_title: ${{ format('{0}', github.event.discussion.title) }}
discussion_author: ${{ github.event.discussion.user.login }}
discussion_repo: ${{ github.event.repository.full_name }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
steps:
- name: Send notification for new discussion
id: slack
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/generate_pot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
generate-pot:
name: Generate POT file
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/issue_automations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ jobs:
run:
name: Perform issue automations
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/label_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
sync_labels:
name: Sync labels
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr_automations.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ jobs:
run:
name: Perform PR automations
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr_automations_init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ jobs:
run:
name: Save event info
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- name: Save event info
run: |
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/pr_label_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- get_label_groups
steps:
- name: Check aspect label
uses: docker://agilepathway/pull-request-label-checker:v1.6.13
uses: docker://agilepathway/pull-request-label-checker:v1.6.20
with:
any_of: ${{ needs.get_label_groups.outputs.aspect }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -55,7 +55,7 @@ jobs:
- get_label_groups
steps:
- name: Check goal label
uses: docker://agilepathway/pull-request-label-checker:v1.6.13
uses: docker://agilepathway/pull-request-label-checker:v1.6.20
with:
one_of: ${{ needs.get_label_groups.outputs.goal }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -68,7 +68,7 @@ jobs:
- get_label_groups
steps:
- name: Check priority label
uses: docker://agilepathway/pull-request-label-checker:v1.6.13
uses: docker://agilepathway/pull-request-label-checker:v1.6.20
with:
one_of: ${{ needs.get_label_groups.outputs.priority }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
Expand All @@ -81,7 +81,7 @@ jobs:
- get_label_groups
steps:
- name: Check stack label
uses: docker://agilepathway/pull-request-label-checker:v1.6.13
uses: docker://agilepathway/pull-request-label-checker:v1.6.20
with:
any_of: ${{ needs.get_label_groups.outputs.stack }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
20 changes: 6 additions & 14 deletions .github/workflows/pr_limit_reminders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,21 +40,13 @@ jobs:
echo "required_review_count=$(( pr_count * 2 ))" >> "$GITHUB_ENV"
- name: Send notification
id: slack
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
# The JSON below looks malformed, with an invalid multiline string, but YAML's `>`
# construct replaces linebreaks with a space, so the multiline string below will end
# up as a single-line string. The payload will be `{ "user": "...", "message": "..." }
payload: >
# Note: We cannot use the YAML folded chomping block syntax here (`>`) because
# GitHub Actions does not support it (they only support a subset of YAML):
# https://github.com/actions/runner/issues/418#issuecomment-612928525
payload: |
{
"user": "${{ env.slack_id }}",
"message":
"Hi, Opener! \n
You currently have ${{ env.pr_count }} Pull Request(s) open with requested
reviews (totalling ${{ env.required_review_count }} required reviews). \n
To help ease the review burden, increase review velocity for older PRs, and
improve the equitable distribution of project maintenance tasks across the team,
please consider reviewing this list of ways to contribute instead of working on
new code contributions: \n
https://docs.openverse.org/meta/maintainer_tasks.html"
"message": "Hi, Opener! \n You currently have ${{ env.pr_count }} Pull Request(s) open with requested reviews (totalling ${{ env.required_review_count }} required reviews). \n To help ease the review burden, increase review velocity for older PRs, and improve the equitable distribution of project maintenance tasks across the team, please consider reviewing this list of ways to contribute instead of working on new code contributions: \n https://docs.openverse.org/meta/maintainer_tasks.html"
}
11 changes: 7 additions & 4 deletions .github/workflows/pr_ping.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,17 @@ on:
jobs:
send_message:
name: Send Slack message
# Prevent running this workflow on forks, it's unnecessary for external contributors
# Also prevent running this for bot-related PRs
if: |
github.actor != 'dependabot[bot]' &&
!startsWith(github.event.pull_request.title, '🔄')
!startsWith(github.event.pull_request.title, '🔄') &&
github.repository_owner == 'WordPress'
runs-on: ubuntu-latest
env:
pr_url: ${{ github.event.pull_request.html_url }}
pr_number: ${{ github.event.pull_request.number }}
pr_title: ${{ toJSON(github.event.pull_request.title) }}
pr_title: ${{ format('{0}', github.event.pull_request.title) }}
pr_author: ${{ github.event.pull_request.user.login }}
pr_repo: ${{ github.event.pull_request.base.repo.full_name }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
Expand All @@ -26,7 +29,7 @@ jobs:
- name: Send notification for new PR
if: github.event.action == 'opened'
id: slack
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
env:
pr_status: ${{ github.event.pull_request.draft && ' draft ' || ' ' }}
pr_icon: ${{ github.event.pull_request.draft && ':pr-draft:' || ':pull-request:' }}
Expand All @@ -47,7 +50,7 @@ jobs:
- name: Send notification for PR marked ready
if: github.event.action == 'ready_for_review'
id: slack-notifications
uses: slackapi/slack-github-action@v1.24.0
uses: slackapi/slack-github-action@v1.25.0
with:
payload: |
{
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/project_thread_update_reminders.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
send-reminders:
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- uses: actions/checkout@v4
- uses: actions/github-script@v6
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/release-app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
release-app:
name: Release app
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
permissions:
# Needed to create the GitHub release on the repo
contents: write
Expand Down
3 changes: 2 additions & 1 deletion .github/workflows/renovate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ env:
jobs:
renovate:
runs-on: ubuntu-latest
if: github.repository == 'WordPress/openverse'
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- uses: actions/checkout@v4

Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/subscribe_to_label.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ on:
jobs:
subscribe:
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- uses: bytecodealliance/subscribe-to-label-action@v1
with:
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/sync_meta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ jobs:
sync_meta:
name: Sync meta files
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/weekly_updates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ jobs:
make_post:
name: Create post on Make site
runs-on: ubuntu-latest
# Prevent running this workflow on forks, it's unnecessary for external contributors
if: github.repository_owner == 'WordPress'
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand Down
34 changes: 21 additions & 13 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,15 @@ repos:
entry: bash -c 'if [ ! -f "$(dirname "$dir")"/frontend/src/locales/ar.json ]; then just frontend/run i18n; fi'
language: system
pass_filenames: false
- id: fix-console-code-block
name: Ensure "bash" code block is used over "console"
files: ^documentation/.*\.md$
# Check that we are not using the ```console block in our documentation
# -R recursively checks files
# -l suppresses normal input and only lists files with errors
# Print an error message if any files are found
entry: sed -i -e 's/```console/```bash/g'
language: system

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
Expand All @@ -36,7 +45,7 @@ repos:
- id: requirements-txt-fixer

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.1.9
rev: v0.2.0
hooks:
- id: ruff # replaces Flake8, isort, pydocstyle, pyupgrade
args:
Expand Down Expand Up @@ -110,13 +119,15 @@ repos:
entry: bash -c 'pnpm run -r types'
language: system
pass_filenames: false

- id: eslint
name: eslint
files: (frontend|automations|packages).*?\.(js|ts|vue|json5|json)$
"types": [file] # ESLint only accepts [javascript] by default.
language: system
pass_filenames: false
entry: bash -c 'pnpm run eslint --fix'

- id: test:unit
name: test:unit
files: ^(frontend|packages)/.*$
Expand All @@ -125,27 +136,24 @@ repos:
pass_filenames: false
stages:
- push

- id: render-release-drafter
name: render-release-drafter
files: ^templates/.*$
entry: bash -c 'just automations/js/render-release-drafter'
language: system
pass_filenames: false

- id: vale
name: vale
language: system
entry: bash -c 'just .vale/run'
pass_filenames: false
files: (.vale/.*|.mdx?)$

- repo: https://github.com/renovatebot/pre-commit-hooks
rev: 37.116.0
rev: 37.168.1
hooks:
- id: renovate-config-validator
args:
- --strict

- repo: local
hooks:
- id: codeowners-validator
name: CODEOWNERS validator
language: docker_image
pass_filenames: false
entry: >
-e REPOSITORY_PATH="."
-e CHECKS="files,duppatterns,syntax"
ghcr.io/mszostok/codeowners-validator:v0.7.4
3 changes: 3 additions & 0 deletions .vale/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
styles/*
!styles/Vocab/
!styles/Openverse/
43 changes: 43 additions & 0 deletions .vale/.vale.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
StylesPath = styles

MinAlertLevel = suggestion
Vocab = Openverse
# Using an explicit reference to downloads for package zips rather than the shorthand allows us to
# pin the package to a specific version. Otherwise, changes in the upstream style configuration can
# cause sudden and unexpected failures during linting.
Packages = https://github.com/errata-ai/proselint/releases/download/v0.3.3/proselint.zip

# The default settings also ignore `pre` and `code`, which includes admonition code blocks.
# We may encounter false positives by including code blocks, but we use admonitions
# so frequently in Openverse documentation that it is probably worth it to include them.
SkippedScopes = script, style, figure
IgnoredScopes = tt

[formats]
# Treat mdx as markdown (for Storybook support)
mdx = md

# Only configure Markdown, because that's the only language we use to write documentation in
# (Except MDX, but if we want to add Vale there it will have to be at a later date to avoid complexity
# in the initial setup)
[*.md]
BasedOnStyles = proselint, Vale, Openverse

# Avoid Vale.Spelling for now, but we do want Vale.Terms for the vocab at least
Vale.Spelling = NO

# The suggested terms are obscure
proselint.AnimalLabels = NO

# These are rarely necessary changes and can be more fiddly than they are helpful
proselint.Typography = NO

# proselint.Needless considers a host of terms "needless" which are natural and wide-spread changes in the English language,
# and is clearly favouring US changes rather than others (the US isn't the only or even the largest English speaking country).
# You don't have to look far to find examples of this rule preferring variants of terms in line with 18th century elite preferences:
# https://www.merriam-webster.com/grammar/preventive-or-preventative
# In other words, it's a linguistic prescriptive holdover to insist on some of these terms being "needless" when they're in
# fact widespread and well understood. Not all the terms have this issue, but we'd have to rewrite
# practically the entire rule to sort out which ones we cared about. If we find any we _do_ care about, we can add them to our
# own substitution rule.
proselint.Needless = NO
Loading

0 comments on commit 8192a5d

Please sign in to comment.