Merge pull request 'matrix-bot: Fix missing mention if username is slightly different.' (#223) from Qubasa/clan-infra:Qubasa-main into main
All checks were successful
buildbot/nix-build .#checks.x86_64-linux.devShell-clan-merge Build done.
buildbot/nix-eval Build done.
buildbot/nix-build .#checks.x86_64-linux.treefmt Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-homepage Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-matrix-bot Build done.
buildbot/nix-build .#checks.x86_64-linux.nixos-web01 Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update Build done.
buildbot/nix-build .#checks.x86_64-linux.package-gitea Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-infra Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-clan-core Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-flake-update-pr-clan Build done.
buildbot/nix-build .#checks.x86_64-linux.package-matrix-bot Build done.
buildbot/nix-build .#checks.x86_64-linux.devShell-default Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-create-pr Build done.
buildbot/nix-build .#checks.x86_64-linux.package-job-flake-update-data-mesher Build done.
buildbot/nix-build .#checks.x86_64-linux.package-clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.clan-merge Build done.
buildbot/nix-build .#checks.x86_64-linux.package-action-ensure-tea-login Build done.

This commit is contained in:
clan-bot 2024-07-22 13:19:32 +00:00
commit 4bff8ab685
2 changed files with 20 additions and 14 deletions

View File

@ -172,21 +172,26 @@ async def changelog_bot(
Create a concise changelog
Follow these guidelines:
- Keep the summary brief
- Follow the pull request format: "scope: message (#number1, #number2)"
- Don't use the commit messages tied to a pull request as is and instead explain the change in a user-friendly way
- Link pull requests as: '{gitea.url}/{gitea.owner}/{gitea.repo}/pulls/<number>'
- Use markdown links to make the pull request number clickable
- Mention each pull request number at most once
- Focus on new clan modules if any
- Group similar changes / pull requests together
- Explain changes in a user-friendly way
- Always use four '#' for headings never less than that. Example: `####New Features`
---
Example Changelog:
#### Changelog:
For the last {matrix.changelog_frequency} days from {fromdate} to {todate}
#### New Features
- `secrets`: Users can now generate secrets and manage settings in the new submodules [#1679]({gitea.url}/{gitea.owner}/{gitea.repo}/pulls/1679)
- `sshd`: A workaround has been added to mitigate the security vulnerability [#1674]({gitea.url}/{gitea.owner}/{gitea.repo}/pulls/1674)
- `secrets`: [#1679]({gitea.url}/{gitea.owner}/{gitea.repo}/pulls/1679)
> Users can now generate secrets and manage settings in the new submodules
> This feature is available to all users with the 'admin' role
> ...
- `sshd`: [#1674]({gitea.url}/{gitea.owner}/{gitea.repo}/pulls/1674)
> A workaround has been added to mitigate the security vulnerability in the sshd module
> This workaround is temporary and will be replaced with a permanent fix in the next release
...
#### Refactoring
...
@ -216,21 +221,19 @@ For the last {matrix.changelog_frequency} days from {fromdate} to {todate}
all_changelogs.append(changelog)
full_changelog = "\n\n".join(all_changelogs)
log.debug(f"Changelog generated:\n{full_changelog}")
combine_prompt = """
Please combine the following changelogs into a single markdown changelog.
- Merge the sections and remove any duplicates.
- Merge duplicates sections.
- Make sure the changelog is concise and easy to read.
- Always use four '#' for headings never less than that. Example: `####New Features`
- WRITE IN THE STYLE OF THE NEW YORK TIMES, PLEASE!
---
Example Changelog:
#### Changelog:
For the last {matrix.changelog_frequency} days from {fromdate} to {todate}
#### New Features
- **inventory**:
- Initial support for deployment info for machines [#1767](https://git.clan.lol/clan/clan-core/pulls/1767)
- Automatic inventory schema checks and runtime assertions [#1753](https://git.clan.lol/clan/clan-core/pulls/1753)
- **webview**:
- Introduced block devices view and machine flashing UI [#1745](https://git.clan.lol/clan/clan-core/pulls/1745), [#1768](https://git.clan.lol/clan/clan-core/pulls/1768)
- Migration to solid-query for improved resource fetching & caching [#1755](https://git.clan.lol/clan/clan-core/pulls/1755)
...
#### Refactoring
...

View File

@ -54,7 +54,7 @@ async def review_requested_bot(
raise Exception(f"Failed to join room {room}")
# Get the members of the room
users = await get_room_members(client, room)
room_users = await get_room_members(client, room)
# Fetch the pull requests
tstart = time.time()
@ -97,8 +97,11 @@ async def review_requested_bot(
# Check if the requested reviewers are in the room
ping_users = []
for user in users:
if user.display_name.lower() in mentioned_users:
for user in room_users:
user_name = user.display_name.lower()
if any(
user_name in mentioned_user for mentioned_user in mentioned_users
):
ping_users.append(user.user_id)
# Send a message to the room and mention the users