Skip to content

Commit

Permalink
Minor edits to workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis committed Nov 13, 2024
1 parent 7e2c8f5 commit b8de13b
Showing 1 changed file with 87 additions and 89 deletions.
176 changes: 87 additions & 89 deletions .github/workflows/matrix_dev_sync_reminder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ jobs:
weekdiff=$(((end - start) / 60 / 60 / 24 / 7))
weekindex=$((weekdiff % 2))
# Calculate next bi-weekly date
# Calculate next bi-weekly date.
if [ "$weekindex" -eq 0 ]; then
next_bi_weekly_date=$(date -d "$current_date + 14 days" +%Y-%m-%d)
next_next_bi_weekly_date=$(date -d "$current_date + 28 days" +%Y-%m-%d)
Expand Down Expand Up @@ -74,95 +74,94 @@ jobs:
echo "Next next bi-weekly date: ${{ needs.weekindex.outputs.next_next_bi_weekly_date }}" >> $GITHUB_STEP_SUMMARY
echo "Next next EPOCH time (for sync): $next_next_epoch_time" >> $GITHUB_STEP_SUMMARY
- name: Etherpad Creation
env:
NEXT_BI_WEEKLY_DATE: ${{ env.NEXT_BI_WEEKLY_DATE }}
NEXT_EPOCH_TIME: ${{ env.NEXT_EPOCH_TIME }}
NEXT_NEXT_BI_WEEKLY_DATE: ${{ env.NEXT_NEXT_BI_WEEKLY_DATE }}
NEXT_NEXT_EPOCH_TIME: ${{ env.NEXT_NEXT_EPOCH_TIME }}
NEXT_BI_WEEKLY_DATE: ${{ env.NEXT_BI_WEEKLY_DATE }}
NEXT_EPOCH_TIME: ${{ env.NEXT_EPOCH_TIME }}
NEXT_NEXT_BI_WEEKLY_DATE: ${{ env.NEXT_NEXT_BI_WEEKLY_DATE }}
NEXT_NEXT_EPOCH_TIME: ${{ env.NEXT_NEXT_EPOCH_TIME }}
run: |
pip install requests
python - <<EOF
import requests
import os
next_epoch_time = os.environ.get('NEXT_EPOCH_TIME')
next_bi_weekly_date = os.environ.get('NEXT_BI_WEEKLY_DATE')
next_next_epoch_time = os.environ.get('NEXT_NEXT_EPOCH_TIME')
next_next_bi_weekly_date = os.environ.get('NEXT_NEXT_BI_WEEKLY_DATE')
pad_name = f'scribe-dev-sync-{next_bi_weekly_date}'
url = f'https://etherpad.wikimedia.org/p/{pad_name}/import'
print(f"Importing content to: https://etherpad.wikimedia.org/p/{pad_name}")
# The text you want to add to the pad
content = f"""<html><body>
<h1>Scribe Dev Sync {next_bi_weekly_date}</h1>
<p>Pad directory: https://etherpad.wikimedia.org/p/scribe-dev-sync</a><br>
ZoneStamp: https://zonestamp.toolforge.org/{next_epoch_time}</a></p>
<br> <!-- Added space -->
<h2>Participants (please list yourself if you'd like to)</h2>
<ul>
<li>Participant</li>
</ul>
<br> <!-- Added space -->
<h2>Topics</h2>
<ul>
<li>All: introductions πŸ‘‹</li>
<li>All: does anyone want a calendar invite to the dev sync? If so, send them out :)
<ul>
<li>If you would like an invite, please message Andrew on Matrix/Element</li>
</ul>
</li>
<li>Recap done by: NAME</li>
<li>Go through the [project board](https://github.com/orgs/scribe-org/projects/1)</a></li>
<li>Name:</li>
</ul>
<br> <!-- Added space -->
<h2>Tasks (strikethrough ^/⌘ + 5 to mark as complete)</h2>
<ul>
<li>Task</li>
</ul>
<br> <!-- Added space -->
<h2>Recap</h2>
<br> <!-- Added space -->
<br> <!-- Added space -->
<p>Here's the recap for today's/Saturday's dev sync πŸ§‘β€πŸ’»β™»οΈ</p>
<ul>
<li>[Pad for this week](https://etherpad.wikimedia.org/p/scribe-dev-sync-${{ env.NEXT_BI_WEEKLY_DATE }}) </a></li>
<li>Note</li>
</ul>
<br> <!-- Added space -->
<p>The next dev sync will be [Saturday the {next_next_bi_weekly_date} at 15:00 UTC](https://zonestamp.toolforge.org/{next_next_epoch_time}) </a>.</p>
<br> <!-- Added space -->
<p>Nice outro 😊</p>
</body></html>"""
# Prepare the file to upload
files = {
'file': ('import.html', content.encode('utf-8'), 'text/html'),
}
response = requests.post(url, files=files)
if response.status_code in [200, 302]:
print(f"Content imported successfully into pad '{pad_name}'.")
elif response.status_code == 413:
print("The file is too large to upload.")
else:
print(f"Failed to import content. Status code: {response.status_code}")
print(response.text)
EOF
pip install requests
python - <<EOF
import requests
import os
next_epoch_time = os.environ.get('NEXT_EPOCH_TIME')
next_bi_weekly_date = os.environ.get('NEXT_BI_WEEKLY_DATE')
next_next_epoch_time = os.environ.get('NEXT_NEXT_EPOCH_TIME')
next_next_bi_weekly_date = os.environ.get('NEXT_NEXT_BI_WEEKLY_DATE')
pad_name = f'scribe-dev-sync-{next_bi_weekly_date}'
url = f'https://etherpad.wikimedia.org/p/{pad_name}/import'
print(f"Importing content to: https://etherpad.wikimedia.org/p/{pad_name}")
# The text you want to add to the pad.
content = f"""<html><body>
<h1>Scribe Dev Sync {next_bi_weekly_date}</h1>
<p>Pad directory: https://etherpad.wikimedia.org/p/scribe-dev-sync</a><br>
ZoneStamp: https://zonestamp.toolforge.org/{next_epoch_time}</a></p>
<br>
<h2>Participants (please list yourself if you'd like to)</h2>
<ul>
<li>Participant</li>
</ul>
<br>
<h2>Topics</h2>
<ul>
<li>All: introductions πŸ‘‹</li>
<li>All: does anyone want a calendar invite to the dev sync? If so, send them out :)
<ul>
<li>If you would like an invite, please message the team on Matrix/Element</li>
</ul>
</li>
<li>Recap done by: NAME</li>
<li>Go through the [project board](https://github.com/orgs/scribe-org/projects/1)</a></li>
<li>Name:</li>
</ul>
<br>
<h2>Tasks (strikethrough ^/⌘ + 5 to mark as complete)</h2>
<ul>
<li>Task</li>
</ul>
<br>
<h2>Recap</h2>
<br>
<br>
<p>Here's the recap for today's/Saturday's dev sync πŸ§‘β€πŸ’»β™»οΈ</p>
<ul>
<li>[Pad for this week](https://etherpad.wikimedia.org/p/scribe-dev-sync-${{ env.NEXT_BI_WEEKLY_DATE }}) </a></li>
<li>Note</li>
</ul>
<br>
<p>The next dev sync will be [Saturday the {next_next_bi_weekly_date} at 15:00 UTC](https://zonestamp.toolforge.org/{next_next_epoch_time})</a>.</p>
<br>
<p>Nice outro 😊</p>
</body></html>"""
# Prepare the file to upload.
files = {
'file': ('import.html', content.encode('utf-8'), 'text/html'),
}
response = requests.post(url, files=files)
if response.status_code in [200, 302]:
print(f"Content imported successfully into pad '{pad_name}'.")
elif response.status_code == 413:
print("The file is too large to upload.")
else:
print(f"Failed to import content. Status code: {response.status_code}")
print(response.text)
EOF
- name: Send Message to Matrix Channel
id: matrix-chat-message
Expand All @@ -174,7 +173,7 @@ jobs:
message: |
Hello all! πŸ€–πŸ‘‹ Here's the reminder for [this Saturday's dev sync at 15:00 UTC](https://zonestamp.toolforge.org/${{ env.NEXT_EPOCH_TIME }}) πŸ§‘β€πŸ’»β™»οΈ
For those new to the community, every two Saturdays the Scribe team does a call to discuss the projects. We use [Element Call](https://call.element.io/) and will also use a [pad from Wikimedia's Etherpad instance](https://etherpad.wikimedia.org/) for taking notes. Note that Element Call doesn't have a chat, so questions need to be written in the pad :)
For those new to the community, every two Saturdays the Scribe team does a call to discuss the projects. We use [Element Call](https://call.element.io/) and will also use a [pad from Wikimedia's Etherpad instance](https://etherpad.wikimedia.org/p/scribe-dev-sync-${{ env.NEXT_BI_WEEKLY_DATE }}) for taking notes. Note that Element Call doesn't have a chat, so questions need to be written in the pad :)
Details for the upcoming sync:
Expand All @@ -185,4 +184,3 @@ jobs:
Please reply in the thread for this message with anything you'd like to discuss 🧡
Thanks and have a great day! πŸ’™

0 comments on commit b8de13b

Please sign in to comment.