diff --git a/src/oca_github_bot/config.py b/src/oca_github_bot/config.py index d445452a..b1b886c8 100644 --- a/src/oca_github_bot/config.py +++ b/src/oca_github_bot/config.py @@ -59,7 +59,7 @@ def func_wrapper(*args, **kwargs): # Available tasks: # delete_branch,tag_approved,tag_ready_to_merge,gen_addons_table, # gen_addons_readme,gen_addons_icon,setuptools_odoo,merge_bot,tag_needs_review, -# migration_issue_bot,whool_init,gen_metapackage +# migration_issue_bot,whool_init,gen_metapackage,label_modified_addons BOT_TASKS = os.environ.get("BOT_TASKS", "all").split(",") BOT_TASKS_DISABLED = os.environ.get("BOT_TASKS_DISABLED", "").split(",") diff --git a/src/oca_github_bot/tasks/__init__.py b/src/oca_github_bot/tasks/__init__.py index b9d6be7c..29b5a562 100644 --- a/src/oca_github_bot/tasks/__init__.py +++ b/src/oca_github_bot/tasks/__init__.py @@ -3,6 +3,7 @@ from . import ( heartbeat, + label_modified_addons, main_branch_bot, mention_maintainer, migration_issue_bot, diff --git a/src/oca_github_bot/tasks/label_modified_addons.py b/src/oca_github_bot/tasks/label_modified_addons.py new file mode 100644 index 00000000..47c58dd2 --- /dev/null +++ b/src/oca_github_bot/tasks/label_modified_addons.py @@ -0,0 +1,39 @@ +# Copyright (c) ACSONE SA/NV 2024 +# Distributed under the MIT License (http://opensource.org/licenses/MIT). + +from .. import github +from ..config import switchable +from ..manifest import git_modified_addons +from ..process import check_call +from ..queue import task +from ..version_branch import is_main_branch_bot_branch + + +def _label_modified_addons(gh, org, repo, pr, dry_run): + gh_pr = gh.pull_request(org, repo, pr) + target_branch = gh_pr.base.ref + pr_branch = f"tmp-pr-{pr}" + with github.temporary_clone(org, repo, target_branch) as clone_dir: + check_call( + ["git", "fetch", "origin", f"pull/{pr}/head:{pr_branch}"], + cwd=clone_dir, + ) + check_call(["git", "checkout", pr_branch], cwd=clone_dir) + modified_addons, _ = git_modified_addons(clone_dir, target_branch) + if not modified_addons: + return + gh_issue = github.gh_call(gh_pr.issue) + new_labels = {f"addon:{modified_addon}" for modified_addon in modified_addons} + if is_main_branch_bot_branch(target_branch): + new_labels.add(f"series:{target_branch}") + new_labels = new_labels - {label.name for label in gh_issue.labels()} + if new_labels and not dry_run: + for new_label in new_labels: + github.gh_call(gh_issue.add_labels, new_label) + + +@task() +@switchable("label_modified_addons") +def label_modified_addons(org, repo, pr, dry_run): + with github.login() as gh: + _label_modified_addons(gh, org, repo, pr, dry_run) diff --git a/src/oca_github_bot/version_branch.py b/src/oca_github_bot/version_branch.py index 41f43330..be1da6de 100644 --- a/src/oca_github_bot/version_branch.py +++ b/src/oca_github_bot/version_branch.py @@ -33,7 +33,7 @@ def is_main_branch_bot_branch(branch_name): def is_protected_branch(branch_name): - if branch_name == "master": + if branch_name in ("master", "main"): return True return bool(ODOO_VERSION_RE.match(branch_name)) diff --git a/src/oca_github_bot/webhooks/on_pr_label_modified_addons.py b/src/oca_github_bot/webhooks/on_pr_label_modified_addons.py new file mode 100644 index 00000000..59b74ed7 --- /dev/null +++ b/src/oca_github_bot/webhooks/on_pr_label_modified_addons.py @@ -0,0 +1,21 @@ +# Copyright (c) ACSONE SA/NV 2024 +# Distributed under the MIT License (http://opensource.org/licenses/MIT). + +import logging + +from ..router import router +from ..tasks.label_modified_addons import label_modified_addons + +_logger = logging.getLogger(__name__) + + +@router.register("pull_request", action="opened") +@router.register("pull_request", action="reopened") +@router.register("pull_request", action="synchronize") +async def on_pr_label_modified_addons(event, *args, **kwargs): + """ + Whenever a PR is opened, add labels based on modified addons. + """ + org, repo = event.data["repository"]["full_name"].split("/") + pr = event.data["pull_request"]["number"] + label_modified_addons.delay(org, repo, pr) diff --git a/tests/cassettes/test_label_modified_addons.yaml b/tests/cassettes/test_label_modified_addons.yaml new file mode 100644 index 00000000..adfdb5d8 --- /dev/null +++ b/tests/cassettes/test_label_modified_addons.yaml @@ -0,0 +1,445 @@ +interactions: +- request: + body: null + headers: + Accept: + - application/vnd.github.v3.full+json + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - github3.py/4.0.1 + authorization: + - DUMMY + method: GET + uri: https://api.github.com/repos/OCA/mis-builder/pulls/610 + response: + body: + string: '{"url":"https://api.github.com/repos/OCA/mis-builder/pulls/610","id":1892283352,"node_id":"PR_kwDOBkb_ks5wyfPY","html_url":"https://github.com/OCA/mis-builder/pull/610","diff_url":"https://github.com/OCA/mis-builder/pull/610.diff","patch_url":"https://github.com/OCA/mis-builder/pull/610.patch","issue_url":"https://api.github.com/repos/OCA/mis-builder/issues/610","number":610,"state":"open","locked":false,"title":"[15.0][IMP] + add: css sticky table header added for mis-builder-widget","user":{"login":"hitrosol","id":5949936,"node_id":"MDQ6VXNlcjU5NDk5MzY=","avatar_url":"https://avatars.githubusercontent.com/u/5949936?v=4","gravatar_id":"","url":"https://api.github.com/users/hitrosol","html_url":"https://github.com/hitrosol","followers_url":"https://api.github.com/users/hitrosol/followers","following_url":"https://api.github.com/users/hitrosol/following{/other_user}","gists_url":"https://api.github.com/users/hitrosol/gists{/gist_id}","starred_url":"https://api.github.com/users/hitrosol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitrosol/subscriptions","organizations_url":"https://api.github.com/users/hitrosol/orgs","repos_url":"https://api.github.com/users/hitrosol/repos","events_url":"https://api.github.com/users/hitrosol/events{/privacy}","received_events_url":"https://api.github.com/users/hitrosol/received_events","type":"User","site_admin":false},"body":"i + forward the improvement in v14 from https://github.com/OCA/mis-builder/pull/588\r\n","created_at":"2024-05-28T16:40:39Z","updated_at":"2024-05-28T16:40:50Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f69d343c11e0c98cd6ed72e6805850d20a575e0f","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"draft":false,"commits_url":"https://api.github.com/repos/OCA/mis-builder/pulls/610/commits","review_comments_url":"https://api.github.com/repos/OCA/mis-builder/pulls/610/comments","review_comment_url":"https://api.github.com/repos/OCA/mis-builder/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OCA/mis-builder/issues/610/comments","statuses_url":"https://api.github.com/repos/OCA/mis-builder/statuses/d18c5d4d7e64a22c777cfe9a63cd00dae730c522","head":{"label":"hitrosol:15.0-imp-mis_builder","ref":"15.0-imp-mis_builder","sha":"d18c5d4d7e64a22c777cfe9a63cd00dae730c522","user":{"login":"hitrosol","id":5949936,"node_id":"MDQ6VXNlcjU5NDk5MzY=","avatar_url":"https://avatars.githubusercontent.com/u/5949936?v=4","gravatar_id":"","url":"https://api.github.com/users/hitrosol","html_url":"https://github.com/hitrosol","followers_url":"https://api.github.com/users/hitrosol/followers","following_url":"https://api.github.com/users/hitrosol/following{/other_user}","gists_url":"https://api.github.com/users/hitrosol/gists{/gist_id}","starred_url":"https://api.github.com/users/hitrosol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitrosol/subscriptions","organizations_url":"https://api.github.com/users/hitrosol/orgs","repos_url":"https://api.github.com/users/hitrosol/repos","events_url":"https://api.github.com/users/hitrosol/events{/privacy}","received_events_url":"https://api.github.com/users/hitrosol/received_events","type":"User","site_admin":false},"repo":{"id":807198047,"node_id":"R_kgDOMBzdXw","name":"mis-builder","full_name":"hitrosol/mis-builder","private":false,"owner":{"login":"hitrosol","id":5949936,"node_id":"MDQ6VXNlcjU5NDk5MzY=","avatar_url":"https://avatars.githubusercontent.com/u/5949936?v=4","gravatar_id":"","url":"https://api.github.com/users/hitrosol","html_url":"https://github.com/hitrosol","followers_url":"https://api.github.com/users/hitrosol/followers","following_url":"https://api.github.com/users/hitrosol/following{/other_user}","gists_url":"https://api.github.com/users/hitrosol/gists{/gist_id}","starred_url":"https://api.github.com/users/hitrosol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitrosol/subscriptions","organizations_url":"https://api.github.com/users/hitrosol/orgs","repos_url":"https://api.github.com/users/hitrosol/repos","events_url":"https://api.github.com/users/hitrosol/events{/privacy}","received_events_url":"https://api.github.com/users/hitrosol/received_events","type":"User","site_admin":false},"html_url":"https://github.com/hitrosol/mis-builder","description":"Management + Information System reports for Odoo: easily build super fast, beautiful, custom + reports such as P&L, Balance Sheets and more.","fork":true,"url":"https://api.github.com/repos/hitrosol/mis-builder","forks_url":"https://api.github.com/repos/hitrosol/mis-builder/forks","keys_url":"https://api.github.com/repos/hitrosol/mis-builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hitrosol/mis-builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hitrosol/mis-builder/teams","hooks_url":"https://api.github.com/repos/hitrosol/mis-builder/hooks","issue_events_url":"https://api.github.com/repos/hitrosol/mis-builder/issues/events{/number}","events_url":"https://api.github.com/repos/hitrosol/mis-builder/events","assignees_url":"https://api.github.com/repos/hitrosol/mis-builder/assignees{/user}","branches_url":"https://api.github.com/repos/hitrosol/mis-builder/branches{/branch}","tags_url":"https://api.github.com/repos/hitrosol/mis-builder/tags","blobs_url":"https://api.github.com/repos/hitrosol/mis-builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hitrosol/mis-builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hitrosol/mis-builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/hitrosol/mis-builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hitrosol/mis-builder/statuses/{sha}","languages_url":"https://api.github.com/repos/hitrosol/mis-builder/languages","stargazers_url":"https://api.github.com/repos/hitrosol/mis-builder/stargazers","contributors_url":"https://api.github.com/repos/hitrosol/mis-builder/contributors","subscribers_url":"https://api.github.com/repos/hitrosol/mis-builder/subscribers","subscription_url":"https://api.github.com/repos/hitrosol/mis-builder/subscription","commits_url":"https://api.github.com/repos/hitrosol/mis-builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/hitrosol/mis-builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/hitrosol/mis-builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/hitrosol/mis-builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/hitrosol/mis-builder/contents/{+path}","compare_url":"https://api.github.com/repos/hitrosol/mis-builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hitrosol/mis-builder/merges","archive_url":"https://api.github.com/repos/hitrosol/mis-builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hitrosol/mis-builder/downloads","issues_url":"https://api.github.com/repos/hitrosol/mis-builder/issues{/number}","pulls_url":"https://api.github.com/repos/hitrosol/mis-builder/pulls{/number}","milestones_url":"https://api.github.com/repos/hitrosol/mis-builder/milestones{/number}","notifications_url":"https://api.github.com/repos/hitrosol/mis-builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hitrosol/mis-builder/labels{/name}","releases_url":"https://api.github.com/repos/hitrosol/mis-builder/releases{/id}","deployments_url":"https://api.github.com/repos/hitrosol/mis-builder/deployments","created_at":"2024-05-28T16:37:08Z","updated_at":"2024-05-28T16:37:08Z","pushed_at":"2024-05-28T16:38:09Z","git_url":"git://github.com/hitrosol/mis-builder.git","ssh_url":"git@github.com:hitrosol/mis-builder.git","clone_url":"https://github.com/hitrosol/mis-builder.git","svn_url":"https://github.com/hitrosol/mis-builder","homepage":"","size":8072,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"has_discussions":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"agpl-3.0","name":"GNU + Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"allow_forking":true,"is_template":false,"web_commit_signoff_required":false,"topics":[],"visibility":"public","forks":0,"open_issues":0,"watchers":0,"default_branch":"16.0"}},"base":{"label":"OCA:15.0","ref":"15.0","sha":"964efcd53ecc5709f3f7478ccc7f96037db7abf4","user":{"login":"OCA","id":7600578,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MDA1Nzg=","avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=4","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"repo":{"id":105316242,"node_id":"MDEwOlJlcG9zaXRvcnkxMDUzMTYyNDI=","name":"mis-builder","full_name":"OCA/mis-builder","private":false,"owner":{"login":"OCA","id":7600578,"node_id":"MDEyOk9yZ2FuaXphdGlvbjc2MDA1Nzg=","avatar_url":"https://avatars.githubusercontent.com/u/7600578?v=4","gravatar_id":"","url":"https://api.github.com/users/OCA","html_url":"https://github.com/OCA","followers_url":"https://api.github.com/users/OCA/followers","following_url":"https://api.github.com/users/OCA/following{/other_user}","gists_url":"https://api.github.com/users/OCA/gists{/gist_id}","starred_url":"https://api.github.com/users/OCA/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OCA/subscriptions","organizations_url":"https://api.github.com/users/OCA/orgs","repos_url":"https://api.github.com/users/OCA/repos","events_url":"https://api.github.com/users/OCA/events{/privacy}","received_events_url":"https://api.github.com/users/OCA/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/OCA/mis-builder","description":"Management + Information System reports for Odoo: easily build super fast, beautiful, custom + reports such as P&L, Balance Sheets and more.","fork":false,"url":"https://api.github.com/repos/OCA/mis-builder","forks_url":"https://api.github.com/repos/OCA/mis-builder/forks","keys_url":"https://api.github.com/repos/OCA/mis-builder/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OCA/mis-builder/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OCA/mis-builder/teams","hooks_url":"https://api.github.com/repos/OCA/mis-builder/hooks","issue_events_url":"https://api.github.com/repos/OCA/mis-builder/issues/events{/number}","events_url":"https://api.github.com/repos/OCA/mis-builder/events","assignees_url":"https://api.github.com/repos/OCA/mis-builder/assignees{/user}","branches_url":"https://api.github.com/repos/OCA/mis-builder/branches{/branch}","tags_url":"https://api.github.com/repos/OCA/mis-builder/tags","blobs_url":"https://api.github.com/repos/OCA/mis-builder/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OCA/mis-builder/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OCA/mis-builder/git/refs{/sha}","trees_url":"https://api.github.com/repos/OCA/mis-builder/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OCA/mis-builder/statuses/{sha}","languages_url":"https://api.github.com/repos/OCA/mis-builder/languages","stargazers_url":"https://api.github.com/repos/OCA/mis-builder/stargazers","contributors_url":"https://api.github.com/repos/OCA/mis-builder/contributors","subscribers_url":"https://api.github.com/repos/OCA/mis-builder/subscribers","subscription_url":"https://api.github.com/repos/OCA/mis-builder/subscription","commits_url":"https://api.github.com/repos/OCA/mis-builder/commits{/sha}","git_commits_url":"https://api.github.com/repos/OCA/mis-builder/git/commits{/sha}","comments_url":"https://api.github.com/repos/OCA/mis-builder/comments{/number}","issue_comment_url":"https://api.github.com/repos/OCA/mis-builder/issues/comments{/number}","contents_url":"https://api.github.com/repos/OCA/mis-builder/contents/{+path}","compare_url":"https://api.github.com/repos/OCA/mis-builder/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OCA/mis-builder/merges","archive_url":"https://api.github.com/repos/OCA/mis-builder/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OCA/mis-builder/downloads","issues_url":"https://api.github.com/repos/OCA/mis-builder/issues{/number}","pulls_url":"https://api.github.com/repos/OCA/mis-builder/pulls{/number}","milestones_url":"https://api.github.com/repos/OCA/mis-builder/milestones{/number}","notifications_url":"https://api.github.com/repos/OCA/mis-builder/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OCA/mis-builder/labels{/name}","releases_url":"https://api.github.com/repos/OCA/mis-builder/releases{/id}","deployments_url":"https://api.github.com/repos/OCA/mis-builder/deployments","created_at":"2017-09-29T20:53:23Z","updated_at":"2024-07-15T07:40:27Z","pushed_at":"2024-07-22T12:17:53Z","git_url":"git://github.com/OCA/mis-builder.git","ssh_url":"git@github.com:OCA/mis-builder.git","clone_url":"https://github.com/OCA/mis-builder.git","svn_url":"https://github.com/OCA/mis-builder","homepage":"","size":8482,"stargazers_count":141,"watchers_count":141,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"has_discussions":true,"forks_count":299,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":48,"license":{"key":"agpl-3.0","name":"GNU + Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"allow_forking":true,"is_template":false,"web_commit_signoff_required":false,"topics":["erp","hacktoberfest","odoo"],"visibility":"public","forks":299,"open_issues":48,"watchers":141,"default_branch":"16.0"}},"_links":{"self":{"href":"https://api.github.com/repos/OCA/mis-builder/pulls/610"},"html":{"href":"https://github.com/OCA/mis-builder/pull/610"},"issue":{"href":"https://api.github.com/repos/OCA/mis-builder/issues/610"},"comments":{"href":"https://api.github.com/repos/OCA/mis-builder/issues/610/comments"},"review_comments":{"href":"https://api.github.com/repos/OCA/mis-builder/pulls/610/comments"},"review_comment":{"href":"https://api.github.com/repos/OCA/mis-builder/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OCA/mis-builder/pulls/610/commits"},"statuses":{"href":"https://api.github.com/repos/OCA/mis-builder/statuses/d18c5d4d7e64a22c777cfe9a63cd00dae730c522"}},"author_association":"FIRST_TIME_CONTRIBUTOR","auto_merge":null,"body_html":"
i forward the improvement in v14 from #588
","body_text":"i + forward the improvement in v14 from #588","active_lock_reason":null,"merged":false,"mergeable":true,"rebaseable":true,"mergeable_state":"clean","merged_by":null,"comments":1,"review_comments":0,"maintainer_can_modify":true,"commits":1,"additions":5,"deletions":0,"changed_files":1}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 22 Jul 2024 14:59:09 GMT + ETag: + - W/"349e69944f52bbb4a1519332cd5cf2185f4d6b247a8cbbe79f11392cbf12b94f" + Last-Modified: + - Tue, 16 Jul 2024 12:41:22 GMT + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - github.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3; param=full; format=json + X-GitHub-Request-Id: + - CBDE:1F8EBA:3CBC0C1:3D7FE1D:669E73BC + X-OAuth-Scopes: + - gist, read:org, repo + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4979' + X-RateLimit-Reset: + - '1721660983' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '21' + X-XSS-Protection: + - '0' + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - 178c6fc778ccc68e1d6a + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/vnd.github.v3.full+json + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - github3.py/4.0.1 + authorization: + - DUMMY + method: GET + uri: https://api.github.com/repos/OCA/mis-builder/issues/610 + response: + body: + string: '{"url":"https://api.github.com/repos/OCA/mis-builder/issues/610","repository_url":"https://api.github.com/repos/OCA/mis-builder","labels_url":"https://api.github.com/repos/OCA/mis-builder/issues/610/labels{/name}","comments_url":"https://api.github.com/repos/OCA/mis-builder/issues/610/comments","events_url":"https://api.github.com/repos/OCA/mis-builder/issues/610/events","html_url":"https://github.com/OCA/mis-builder/pull/610","id":2321506384,"node_id":"PR_kwDOBkb_ks5wyfPY","number":610,"title":"[15.0][IMP] + add: css sticky table header added for mis-builder-widget","user":{"login":"hitrosol","id":5949936,"node_id":"MDQ6VXNlcjU5NDk5MzY=","avatar_url":"https://avatars.githubusercontent.com/u/5949936?v=4","gravatar_id":"","url":"https://api.github.com/users/hitrosol","html_url":"https://github.com/hitrosol","followers_url":"https://api.github.com/users/hitrosol/followers","following_url":"https://api.github.com/users/hitrosol/following{/other_user}","gists_url":"https://api.github.com/users/hitrosol/gists{/gist_id}","starred_url":"https://api.github.com/users/hitrosol/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hitrosol/subscriptions","organizations_url":"https://api.github.com/users/hitrosol/orgs","repos_url":"https://api.github.com/users/hitrosol/repos","events_url":"https://api.github.com/users/hitrosol/events{/privacy}","received_events_url":"https://api.github.com/users/hitrosol/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2024-05-28T16:40:39Z","updated_at":"2024-05-28T16:40:50Z","closed_at":null,"author_association":"FIRST_TIME_CONTRIBUTOR","active_lock_reason":null,"draft":false,"pull_request":{"url":"https://api.github.com/repos/OCA/mis-builder/pulls/610","html_url":"https://github.com/OCA/mis-builder/pull/610","diff_url":"https://github.com/OCA/mis-builder/pull/610.diff","patch_url":"https://github.com/OCA/mis-builder/pull/610.patch","merged_at":null},"body_html":"i forward the improvement in v14 from #588
","body_text":"i + forward the improvement in v14 from #588","body":"i forward the improvement + in v14 from https://github.com/OCA/mis-builder/pull/588\r\n","closed_by":null,"reactions":{"url":"https://api.github.com/repos/OCA/mis-builder/issues/610/reactions","total_count":0,"+1":0,"-1":0,"laugh":0,"hooray":0,"confused":0,"heart":0,"rocket":0,"eyes":0},"timeline_url":"https://api.github.com/repos/OCA/mis-builder/issues/610/timeline","performed_via_github_app":null,"state_reason":null}' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 22 Jul 2024 14:59:10 GMT + ETag: + - W/"d332c523a21b9a9faaa33e5e882d44d869815b8a3f7e561c569de01c54883fa9" + Last-Modified: + - Tue, 16 Jul 2024 12:41:22 GMT + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - github.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - repo + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3; param=full; format=json + X-GitHub-Request-Id: + - CBE0:BDA7:39AFF92:3A74BEA:669E73BE + X-OAuth-Scopes: + - gist, read:org, repo + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4978' + X-RateLimit-Reset: + - '1721660983' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '22' + X-XSS-Protection: + - '0' + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - 178c6fc778ccc68e1d6a + status: + code: 200 + message: OK +- request: + body: null + headers: + Accept: + - application/vnd.github.v3.full+json + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Type: + - application/json + User-Agent: + - github3.py/4.0.1 + authorization: + - DUMMY + method: GET + uri: https://api.github.com/repos/OCA/mis-builder/issues/610/labels?per_page=100 + response: + body: + string: '[]' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Length: + - '2' + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 22 Jul 2024 14:59:11 GMT + ETag: + - '"3dc5f90d8a17a2b739a1e29e487fdbcad6e820ab2b5af0e889706531b02bbf03"' + Last-Modified: + - Tue, 16 Jul 2024 12:41:22 GMT + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - github.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - repo + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3; param=full; format=json + X-GitHub-Request-Id: + - D2BC:FDBD6:3CB11E3:3D745EB:669E73BE + X-OAuth-Scopes: + - gist, read:org, repo + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4977' + X-RateLimit-Reset: + - '1721660983' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '23' + X-XSS-Protection: + - '0' + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - 178c6fc778ccc68e1d6a + status: + code: 200 + message: OK +- request: + body: '["addon:mis_builder"]' + headers: + Accept: + - application/vnd.github.v3.full+json + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '21' + Content-Type: + - application/json + User-Agent: + - github3.py/4.0.1 + authorization: + - DUMMY + method: POST + uri: https://api.github.com/repos/OCA/mis-builder/issues/610/labels + response: + body: + string: '[{"id":7236411066,"node_id":"LA_kwDOBkb_ks8AAAABr1Leug","url":"https://api.github.com/repos/OCA/mis-builder/labels/addon:mis_builder","name":"addon:mis_builder","color":"ededed","default":false,"description":null}]' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 22 Jul 2024 14:59:12 GMT + ETag: + - W/"f39940686b455dcbe66671162ad0b673044bc0c53d8491b8e696d38e01db10b1" + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - github.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3; param=full; format=json + X-GitHub-Request-Id: + - D2C8:131774:3A030B7:3AC7956:669E73BF + X-OAuth-Scopes: + - gist, read:org, repo + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4976' + X-RateLimit-Reset: + - '1721660983' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '24' + X-XSS-Protection: + - '0' + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - 178c6fc778ccc68e1d6a + status: + code: 200 + message: OK +- request: + body: '["series:15.0"]' + headers: + Accept: + - application/vnd.github.v3.full+json + Accept-Charset: + - utf-8 + Accept-Encoding: + - gzip, deflate + Connection: + - keep-alive + Content-Length: + - '15' + Content-Type: + - application/json + User-Agent: + - github3.py/4.0.1 + authorization: + - DUMMY + method: POST + uri: https://api.github.com/repos/OCA/mis-builder/issues/610/labels + response: + body: + string: '[{"id":7236411066,"node_id":"LA_kwDOBkb_ks8AAAABr1Leug","url":"https://api.github.com/repos/OCA/mis-builder/labels/addon:mis_builder","name":"addon:mis_builder","color":"ededed","default":false,"description":null},{"id":7236411148,"node_id":"LA_kwDOBkb_ks8AAAABr1LfDA","url":"https://api.github.com/repos/OCA/mis-builder/labels/series:15.0","name":"series:15.0","color":"ededed","default":false,"description":null}]' + headers: + Access-Control-Allow-Origin: + - '*' + Access-Control-Expose-Headers: + - ETag, Link, Location, Retry-After, X-GitHub-OTP, X-RateLimit-Limit, X-RateLimit-Remaining, + X-RateLimit-Used, X-RateLimit-Resource, X-RateLimit-Reset, X-OAuth-Scopes, + X-Accepted-OAuth-Scopes, X-Poll-Interval, X-GitHub-Media-Type, X-GitHub-SSO, + X-GitHub-Request-Id, Deprecation, Sunset + Cache-Control: + - private, max-age=60, s-maxage=60 + Content-Encoding: + - gzip + Content-Security-Policy: + - default-src 'none' + Content-Type: + - application/json; charset=utf-8 + Date: + - Mon, 22 Jul 2024 14:59:12 GMT + ETag: + - W/"f89cc535c8d3c3c36c5c4257109ef0ddb9c01db44ba5fb1751299d23ef07a085" + Referrer-Policy: + - origin-when-cross-origin, strict-origin-when-cross-origin + Server: + - github.com + Strict-Transport-Security: + - max-age=31536000; includeSubdomains; preload + Transfer-Encoding: + - chunked + Vary: + - Accept, Authorization, Cookie, X-GitHub-OTP,Accept-Encoding, Accept, X-Requested-With + X-Accepted-OAuth-Scopes: + - '' + X-Content-Type-Options: + - nosniff + X-Frame-Options: + - deny + X-GitHub-Media-Type: + - github.v3; param=full; format=json + X-GitHub-Request-Id: + - D2CC:71508:3AF8AA9:3BBC050:669E73C0 + X-OAuth-Scopes: + - gist, read:org, repo + X-RateLimit-Limit: + - '5000' + X-RateLimit-Remaining: + - '4975' + X-RateLimit-Reset: + - '1721660983' + X-RateLimit-Resource: + - core + X-RateLimit-Used: + - '25' + X-XSS-Protection: + - '0' + x-github-api-version-selected: + - '2022-11-28' + x-oauth-client-id: + - 178c6fc778ccc68e1d6a + status: + code: 200 + message: OK +version: 1 diff --git a/tests/test_label_modified_addons.py b/tests/test_label_modified_addons.py new file mode 100644 index 00000000..d5763c7b --- /dev/null +++ b/tests/test_label_modified_addons.py @@ -0,0 +1,10 @@ +# Copyright ACSONE SA/NV 2024 +# Distributed under the MIT License (http://opensource.org/licenses/MIT). +import pytest + +from oca_github_bot.tasks.label_modified_addons import _label_modified_addons + + +@pytest.mark.vcr() +def test_label_modified_addons(gh): + _label_modified_addons(gh, "OCA", "mis-builder", "610", dry_run=False)