Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use label.yml to determine required labels #1063

Merged
merged 8 commits into from
Mar 31, 2023
Merged

Conversation

Tomvth
Copy link
Contributor

@Tomvth Tomvth commented Mar 29, 2023

Fixes

Fixes #884 by @AetherUnbound

Description

This PR implements both changes mentioned in the issue.

  1. Instead of using a hardcoded list of labels explicitly defined in labels_pr.py, instead now the labels which have set is_required to True are parsed from the labels.yml data file.
  2. The GET_ALL_CATEGORY_LABELS list is replaced and is also dynamically parsed from labels.yml, to do this a new apply_all_available boolean was added for each group.

Since labels.yml was encoded in utf-8, an optional argument to the load_data function was added to allow specifying the file encoding.

Testing Instructions

Run the labels_pr.py file, verify that the parsed list equates the original explicitly defined list.

Checklist

  • 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.
  • 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.

Developer Certificate of Origin

Developer Certificate of Origin
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.

@Tomvth Tomvth requested a review from a team as a code owner March 29, 2023 14:27
@openverse-bot openverse-bot added this to Needs review in Openverse PRs Mar 29, 2023
@github-actions github-actions bot added the 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work label Mar 29, 2023
@AetherUnbound AetherUnbound added 🟩 priority: low Low priority and doesn't need to be rushed ✨ goal: improvement Improvement to an existing user-facing feature 🤖 aspect: dx Concerns developers' experience with the codebase 🧱 stack: mgmt Related to repo management and automations and removed 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Mar 29, 2023
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the contribution! It looks like the linting checks might be failing, please try running just lint and committing the changes. I also have a few other suggestions for how to improve this approach.

automations/data/labels.yml Outdated Show resolved Hide resolved
@@ -12,16 +12,20 @@


@cache
def get_data(file_name: str) -> dict:
def get_data(file_name: str, encoding: str = None) -> dict:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this necessary for reading the file? Python should default to utf-8 when opening files if it's not set explicitly. Even if we needed to make this explicit here, we should just default to utf-8 anyway and avoid the need for the if encoding block below.

Copy link
Contributor Author

@Tomvth Tomvth Mar 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems that the encoding used by open() is platform-specific, although utf-8 seems to be the most prevalent. On my platform running open() on labels.yml results in UnicodeDecodeError: 'charmap' codec can't decode byte 0x8f in position 980: character maps to <undefined>. Specifying "utf-8" as encoding method fixes this.
I agree on making it the default and I removed the if statement, get_data() now defaults to utf-8.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What platform are you using @Tomvth? Since these actions will be running inside GitHub Actions, the default encoding will be UTF-8.

@AetherUnbound AetherUnbound changed the title Use label.yml to determine required labels #884 Use label.yml to determine required labels Mar 30, 2023
Copy link
Contributor

@AetherUnbound AetherUnbound left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is excellent!! Thanks again for contributing 😄

Copy link
Member

@dhruvkb dhruvkb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this very much, thanks @Tomvth!

Openverse PRs automation moved this from Needs review to Reviewer approved Mar 31, 2023
@dhruvkb dhruvkb merged commit 184cac6 into WordPress:main Mar 31, 2023
Openverse PRs automation moved this from Reviewer approved to Merged! Mar 31, 2023
obulat added a commit that referenced this pull request Apr 5, 2023
* Fix issues in the workflow simplifications of #1054 (#1058)

* Retry `up` recipe in case port is occupied (#990)

* Fix typo in docs building on `main` (#1067)

* Restore Django Admin views (#1065)

* Update other references of media count to 700 million (#1098)

* Dispatch workflows instead of regular reuse to show deployment runs (#1034)

* Use label.yml to determine required labels (#1063)

Co-authored-by: Dhruv Bhanushali <hi@dhruvkb.dev>

* Add `GITHUB_TOKEN` to GitHub CLI step (#1103)

* Pass actor for staging deploys with the `-f` flag (#1104)

* Bump ipython from 8.11.0 to 8.12.0 in /api (#1113)

Bumps [ipython](https://github.com/ipython/ipython) from 8.11.0 to 8.12.0.
- [Release notes](https://github.com/ipython/ipython/releases)
- [Commits](ipython/ipython@8.11.0...8.12.0)

---
updated-dependencies:
- dependency-name: ipython
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Absorb `actionlint` into pre-commit (#1028)

Co-authored-by: Dhruv Bhanushali <dhruv_b@live.com>
Co-authored-by: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com>

* Bump orjson from 3.8.8 to 3.8.9 in /api (#1114)

Bumps [orjson](https://github.com/ijl/orjson) from 3.8.8 to 3.8.9.
- [Release notes](https://github.com/ijl/orjson/releases)
- [Changelog](https://github.com/ijl/orjson/blob/master/CHANGELOG.md)
- [Commits](ijl/orjson@3.8.8...3.8.9)

---
updated-dependencies:
- dependency-name: orjson
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add Sentry to the ingestion server (#1106)

* Add a wait to filter button test to fix CI (#1124)

* Bump boto3 from 1.26.100 to 1.26.104 in /ingestion_server (#1110)

* Bump sentry-sdk from 1.17.0 to 1.18.0 in /api (#1112)

* Bump pillow from 9.4.0 to 9.5.0 in /api (#1115)

* Update redis Docker tag to v4.0.14 (#1109)

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>

* 🔄 synced file(s) with WordPress/openverse-infrastructure (#1127)

Co-authored-by: openverse-bot <null>

* Update other references of media count to 700 million (#1100)

* Fix prod deployment workflow dispatch call (#1117)

* Add a Slack notification job to the CI + CD workflow (#1066)

* Fix types in VFilters and VContentReport (#1030)

* Move the svgs for radiomark and check to components

* Add files to tsconfig and fix types

* Mock report service in the unit test

* Type svg?inline as vue Component

* Better License code type checking

* Update frontend/src/components/VFilters/VFilterChecklist.vue

* Revert unnecessary changes

* Update frontend/src/components/VFilters/VFilterChecklist.vue

Co-authored-by: Zack Krida <zackkrida@pm.me>

* Rename `ownValue` to `value_`

---------

Co-authored-by: Zack Krida <zackkrida@pm.me>

* Convert VPill and VItemGroup stories to mdx (#1092)

* Convert VPill story to MDX
* Convert VItemGroup story to mdx
* Fixing argTypes issue and fixing the headers

* Update ci to use github.token (#1123)

* Add `SLACK_WEBHOOK_TYPE` env var to reporting job (#1131)

* Add consent decision-making process documentation (#887)

* Prepare VButton for updates (#1002)

* Rename button sizes and apply some styles only to 'old' buttons

* Rename the snapshot tests to v-button-old

* Fix VTab focus style

* Small fixes (large-old, border, group/button)

* Revert VTab focus changes

Moved to a different PR

* Revert "Revert VTab focus changes"

This reverts commit ec9312d.

* Use only focus-visible for consistency

* Bump boto3 from 1.26.99 to 1.26.105 in /api (#1133)

Bumps [boto3](https://github.com/boto/boto3) from 1.26.99 to 1.26.105.
- [Release notes](https://github.com/boto/boto3/releases)
- [Changelog](https://github.com/boto/boto3/blob/develop/CHANGELOG.rst)
- [Commits](boto/boto3@1.26.99...1.26.105)

---
updated-dependencies:
- dependency-name: boto3
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Add more docs for Plausible and auto-initialise custom event names (#1122)

* Add more docs for Plausible and auto-initialise custom event names

* Update existing docs

* Add caveat that it is not necessary to run Plausible if not working on custom events

* Fix ToC

* Add new buttons variants and sizes (#1003)

* Add new VButton sizes and variants

* Add new Storybook tests

* Add border to transparent- buttons

* Update bordered and transparent buttons

* Update stories

* Update snapshots

* Remove pressed variants

* Add missing snapshots

* Fix transparent buttons

* Update paddings

In accordance with #860 (comment)

* Update snapshots

* Update frontend/src/components/VButton.vue

Co-authored-by: Zack Krida <zackkrida@pm.me>

---------

Co-authored-by: Zack Krida <zackkrida@pm.me>

* Pass `GITHUB_TOKEN` to deploy docs (#1134)

* Add context manager and join()

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Dhruv Bhanushali <hi@dhruvkb.dev>
Co-authored-by: Krystle Salazar <krystle.salazar@automattic.com>
Co-authored-by: Madison Swain-Bowden <bowdenm@spu.edu>
Co-authored-by: sarayourfriend <24264157+sarayourfriend@users.noreply.github.com>
Co-authored-by: Tomvth <50104959+Tomvth@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Adarsh Rawat <adarshrawat141@gmail.com>
Co-authored-by: Dhruv Bhanushali <dhruv_b@live.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Openverse (Bot) <101814513+openverse-bot@users.noreply.github.com>
Co-authored-by: Zack Krida <zackkrida@pm.me>
Co-authored-by: Sepehr Rezaei <54465154+sepehrrezaei@users.noreply.github.com>
Co-authored-by: Sumit Kashyap <mr.sumitkrr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🤖 aspect: dx Concerns developers' experience with the codebase ✨ goal: improvement Improvement to an existing user-facing feature 🟩 priority: low Low priority and doesn't need to be rushed 🧱 stack: mgmt Related to repo management and automations
Projects
No open projects
Openverse PRs
  
Merged!
Development

Successfully merging this pull request may close these issues.

Use label.yml to determine required labels
3 participants