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

Update commands for matrix bot #61

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .github/linters/.eslintrc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,5 +79,6 @@ rules:
'@typescript-eslint/semi': ['error', 'never'],
'@typescript-eslint/space-before-function-paren': 'off',
'@typescript-eslint/type-annotation-spacing': 'error',
'@typescript-eslint/unbound-method': 'error'
'@typescript-eslint/unbound-method': 'error',
'prefer-template': 'off'
}
2 changes: 1 addition & 1 deletion .github/workflows/create-meeting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ jobs:
uses: ./
with:
issueTitle: 'FCOS Meeting Checklist'
rootURLMeetingLogs: 'https://meetbot-raw.fedoraproject.org/teams/fedora_coreos_meeting/'
rootURLMeetingLogs: 'https://meetbot-raw.fedoraproject.org/meeting-1_matrix_fedoraproject-org/'
trackingRepo: 'coreos/fedora-coreos-tracker'
21 changes: 12 additions & 9 deletions dist/index.js

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

16 changes: 10 additions & 6 deletions src/actionItems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,31 @@ export async function GetActionItems(): Promise<string> {
`(?<=Action Items\n------------\n)((.|\n)*)(?=Action Items,)`
)
const meetingListRegEx = new RegExp(
`(?<=>fedora_coreos_meeting.)(.*?)=?txt`,
`(?<=>fedora-coreos-meeting.)(.*?)=?txt`,
`g`
)
const meetingNotesURL = core.getInput('rootURLMeetingLogs')
let lastMeetingNotesUrl = `fedora_coreos_meeting.`
const allMeetingNotes = core.getInput('rootURLMeetingLogs')
const sevenDaysAgo: string = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000)
.toISOString()
.split('T')[0]
const meetingNotesURL = allMeetingNotes + sevenDaysAgo + `/`
const listOfMeetings = await fetchData(meetingNotesURL)
const matches = listOfMeetings.match(meetingListRegEx)

if (matches != null) {
const lastMeeting = matches[matches.length - 1]
// This should be the latest meeting`s date in with the format of YYYY-MM-DD-HH.MM.txt
lastMeetingNotesUrl = meetingNotesURL + lastMeetingNotesUrl + lastMeeting
console.debug(`last meeting notes url${lastMeetingNotesUrl}`)
const lastMeetingNotesUrl =
meetingNotesURL + 'fedora-coreos-meeting.' + lastMeeting
console.debug(`last meeting notes url ${lastMeetingNotesUrl}`)
const lastMeetingNotes = await fetchData(lastMeetingNotesUrl)
const actionItemMatches = actionItemsRegEx.exec(lastMeetingNotes)

if (actionItemMatches) {
console.debug(`action item matches${actionItemMatches[0]}`)
// if the match is just new lines, then there were no action items
if (actionItemMatches[0].match(/^\s*$/)) {
return `#topic there are no action items from the last meeting.`
return `!topic there are no action items from the last meeting.`
}
return actionItemMatches[0]
}
Expand Down
6 changes: 3 additions & 3 deletions src/meetingTopics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ export async function GetMeetingTopics(): Promise<string> {
state: `open`
})
if (issues.data.length === 0) {
return `#topic No meeting topics found.`
return `!topic No meeting topics found.`
}

let issuesToBeDiscussed = ``
for (const i of issues.data) {
issuesToBeDiscussed += ` - [ ] \`#topic ${i.title}\` \n`
issuesToBeDiscussed += ` - \`#link ${i.html_url}\` \n`
issuesToBeDiscussed += ` - [ ] \`!topic ${i.title}\` \n`
issuesToBeDiscussed += ` - \`!link ${i.html_url}\` \n`
}
return issuesToBeDiscussed
} catch (error) {
Expand Down
72 changes: 43 additions & 29 deletions static/meeting-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Meeting Notes

The meeting is held every week, meetings are at `16:30 UTC` on Wednesdays. The meeting is held in #fedora-meeting-1 on libera.chat. The meeting is logged and the logs are available [here](https://meetbot.fedoraproject.org/teams/fedora_coreos_meeting/)
The meeting is held every week, meetings are at `16:30 UTC` on Wednesdays. The meeting is held in https://matrix.to/#/#meeting-1:fedoraproject.org on matrix. The meeting is logged and the logs are available [here](https://meetbot.fedoraproject.org/teams/fedora_coreos_meeting/)

### Required Concepts

Expand All @@ -18,10 +18,10 @@ Please see [meeting-people.txt](https://github.com/coreos/fedora-coreos-tracker/

<details>
<summary>Meeting host Requirements</summary>
The meeting host needs to have IRC configured and setup on their machine.
The host needs to have access to the following channels on libera.chat
- `#fedora-meeting-1`
- `#fedora-coreos`
The meeting host needs to have a matrix account (an example is an account on the [fedora matrix server](https://chat.fedoraproject.org/#/room/#coreos:fedoraproject.org).)
The host needs to have access to the following channels on matrix
- [#coreos:fedoraproject.org](https://matrix.to/#/#coreos:fedoraproject.org)
- [#meeting-1:fedoraproject.org](https://matrix.to/#/#meeting-1:fedoraproject.org)
The host needs to have a fedora account and be able to post discussion topics to the [fedora project](https://discussion.fedoraproject.org/tag/coreos-wg)
</details>
## For Regularly Scheduled Meetings
Expand Down Expand Up @@ -52,12 +52,12 @@ At least 5 people must vote, or 51% of the WG membership, whichever is less. Vot

## Meeting Steps

1. Join channel #fedora-meeting-1 on libera.chat copy these commands and paste them in the channel
1. Join channel [#coreos:fedoraproject.org](https://matrix.to/#/#coreos:fedoraproject.org) on matrix, copy these commands and paste them in the channel

- [ ] `#startmeeting fedora_coreos_meeting`
- [ ] `#topic roll call`
- [ ] `!startmeeting fedora_coreos_meeting`
- [ ] `!topic roll call`

2. Switch to channel #fedora-coreos on libera.chat
2. Switch to channel [#meeting-1:fedoraproject.org](https://matrix.to/#/#meeting-1:fedoraproject.org) on matrix

- [ ] Copy the following notification and post it

Expand All @@ -67,13 +67,11 @@ At least 5 people must vote, or 51% of the WG membership, whichever is less. Vot
If you don't want to be pinged remove your name from this file: https://github.com/coreos/fedora-coreos-tracker/blob/main/issue_template/meeting-template.md
Copy link
Member

Choose a reason for hiding this comment

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

the line above needs to say:

FCOS community meeting in https://matrix.to/#/#meeting-1:fedoraproject.org

```

3. Switch back to #fedora-meeting-1 wait for people to join and add each of them as a chair

- [ ] `#chair <name>`
3. Switch back to [#meeting-1:fedoraproject.org](https://matrix.to/#/#meeting-1:fedoraproject.org) wait for people to join

4. After 2-4 mins pass start the Action items from last meeting

- [ ] `#topic Action items from last meeting`
- [ ] `!topic Action items from last meeting`
- [ ] `{{action-items}}`

5. After the Action items are covered start the topics from the tracker
Expand All @@ -83,11 +81,11 @@ At least 5 people must vote, or 51% of the WG membership, whichever is less. Vot

6. Once all the topics are covered start the open floor

- [ ] `#topic Open Floor`
- [ ] `!topic Open Floor`

7. Once the time limit is reached or the open floor is quiet end the meeting

- [ ] `#endmeeting`
- [ ] `!endmeeting`

## Housekeeping

Expand Down Expand Up @@ -122,24 +120,40 @@ At least 5 people must vote, or 51% of the WG membership, whichever is less. Vot
- [ ] category: `Project Discussion`
- [ ] tags: `coreos-wg`
- [ ] In the terminal Copy and paste the following

```bash
fcosmeetinghtml() {
local url=$1
# we'll substitute in using the non-raw url for nice highlighting of line numbers
local baseurl=$(dirname $url)
if [[ ! $url =~ raw ]]; then
url=$(echo "$url" | sed "s|meetbot.fedoraproject.org|meetbot-raw.fedoraproject.org|")
fi
# Take the html and delete the <head> contents (doesn't render correctly)
# and also substitute in the base url to make relative URLs absolute.
curl --silent $url | \
sed -z 's|<head>.*</head>||' | \
sed "s|href='fedora|href='${baseurl}/fedora|" | \
sed "s|href=\"fedora|href=\"${baseurl}/fedora|"
SUMMARY_URL="$1"

# Extract meeting date and time from the summary URL
MEETING_DATE_TIME=$(echo "$SUMMARY_URL" | grep -Eo '[0-9]{4}-[0-9]{2}-[0-9]{2}-[0-9]{2}\.[0-9]{2}')

# Extract meeting date from the date and time
MEETING_DATE=$(echo "$MEETING_DATE_TIME" | cut -d'-' -f1-3)

# Generate the log URL based on the meeting date and time
LOG_URL="https://meetbot-raw.fedoraproject.org/meeting-1_matrix_fedoraproject-org/$MEETING_DATE/fedora-coreos-meeting.$MEETING_DATE_TIME.log.html"

# Extract line numbers and timestamps from the log file
timestamps_and_lines=$(curl -s "$LOG_URL" | grep -Eo '<div class="d-table-row" id="l-[0-9]+">|<div class="d-table-cell time shrink pe-1">[0-9]{2}:[0-9]{2}:[0-9]{2}</div>')

# Generate sed commands to replace timestamps with hyperlinks including line numbers
sed_commands=""
current_line=""
while read -r line; do
if [[ "$line" =~ '<div class="d-table-row" id="l-' ]]; then
current_line=$(echo "$line" | grep -Eo 'id="l-[0-9]+"')
elif [[ "$line" =~ '<div class="d-table-cell time shrink pe-1">' ]]; then
timestamp=$(echo "$line" | grep -Eo '[0-9]{2}:[0-9]{2}:[0-9]{2}')
line_number=$(echo "$current_line" | grep -Eo '[0-9]+')
sed_commands+="s@.*<span class=\"details\">.*($timestamp).*<\/span>@<a href=\"$LOG_URL#l-$line_number\">&<\/a>@;"
fi
done <<< "$timestamps_and_lines"

# Apply sed commands to the summary file, delete <head> contents, and echo the result
curl -s "$SUMMARY_URL" | sed -E -e "$sed_commands" | sed '/<head>/,/<\/head>/d' | sed 's/TOPIC://g'
}
```

```
- [ ] In the terminal run `fcosmeetinghtml <this-meetings-notes>.html`
- [ ] Copy and paste the output into the post body

Loading