diff --git a/.github/workflows/matrix_dev_sync_reminder.yml b/.github/workflows/matrix_dev_sync_reminder.yml new file mode 100644 index 0000000..16ec905 --- /dev/null +++ b/.github/workflows/matrix_dev_sync_reminder.yml @@ -0,0 +1,186 @@ +name: matrix_dev_sync_reminder +on: + schedule: + - cron: "0 14 * * 3" # Wednesdays at 14:00 UTC + workflow_dispatch: # manual triggering + +env: + FIRST_RUN_DATE: "2024-11-13" + +jobs: + weekindex: + runs-on: ubuntu-latest + outputs: + weekindex: ${{ steps.calculate.outputs.weekindex }} + next_bi_weekly_date: ${{ steps.calculate.outputs.next_bi_weekly_date }} + next_next_bi_weekly_date: ${{ steps.calculate.outputs.next_next_bi_weekly_date }} + + steps: + - name: Calculate Next Date + id: calculate + run: | + current_date=$(date +%Y-%m-%d) + start=$(date -d "${{ env.FIRST_RUN_DATE }}" +%s) + end=$(date -d "$current_date" +%s) + weekdiff=$(((end - start) / 60 / 60 / 24 / 7)) + weekindex=$((weekdiff % 2)) + + # 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) + + else + next_bi_weekly_date=$(date -d "$current_date + 7 days" +%Y-%m-%d) + next_next_bi_weekly_date=$(date -d "$current_date + 21 days" +%Y-%m-%d) + fi + + echo "weekindex=$weekindex" >> "$GITHUB_OUTPUT" + echo "next_bi_weekly_date=$next_bi_weekly_date" >> "$GITHUB_OUTPUT" + echo "next_next_bi_weekly_date=$next_next_bi_weekly_date" >> "$GITHUB_OUTPUT" + + + echo "FIRST_RUN_DATE: ${{ env.FIRST_RUN_DATE }}" >> $GITHUB_STEP_SUMMARY + echo "current_date: $current_date" >> $GITHUB_STEP_SUMMARY + echo "weekdiff: $weekdiff" >> $GITHUB_STEP_SUMMARY + echo "weekindex: $weekindex" >> $GITHUB_STEP_SUMMARY + echo "next_bi_weekly_date: $next_bi_weekly_date" >> $GITHUB_STEP_SUMMARY + if [ "$weekindex" -eq 0 ]; then + echo "๐ŸŸข It's the first week of the bi-weekly cycle. The action will run." >> $GITHUB_STEP_SUMMARY + else + echo "๐Ÿ”ด It's the second week of the bi-weekly cycle. The action will be skipped." >> $GITHUB_STEP_SUMMARY + fi + + send-message: + if: ${{ needs.weekindex.outputs.weekindex == '0' }} + runs-on: ubuntu-latest + needs: + - weekindex + steps: + - name: Format EPOCH Time + id: epoch-time + run: | + current_epoch_time=$(date +%s) + next_epoch_time=$(date -d "${{ needs.weekindex.outputs.next_bi_weekly_date }} 15:00:00" +%s) + echo "EPOCH_TIME=$current_epoch_time" >> $GITHUB_ENV + echo "NEXT_BI_WEEKLY_DATE=${{ needs.weekindex.outputs.next_bi_weekly_date }}" >> $GITHUB_ENV + echo "NEXT_EPOCH_TIME=$next_epoch_time" >> $GITHUB_ENV + echo "NEXT_NEXT_BI_WEEKLY_DATE=${{ needs.weekindex.outputs.next_next_bi_weekly_date }}" >> $GITHUB_ENV + echo "NEXT_NEXT_EPOCH_TIME=$next_next_epoch_time" >> $GITHUB_ENV + + echo "Current EPOCH time: $current_epoch_time" >> $GITHUB_STEP_SUMMARY + echo "Next bi-weekly date: ${{ needs.weekindex.outputs.next_bi_weekly_date }}" >> $GITHUB_STEP_SUMMARY + echo "Next EPOCH time (for sync): $next_epoch_time" >> $GITHUB_STEP_SUMMARY + 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 }} + run: | + pip install requests + python - < +

Scribe Dev Sync {next_bi_weekly_date}

+ +

Pad directory: https://etherpad.wikimedia.org/p/scribe-dev-sync
+ ZoneStamp: https://zonestamp.toolforge.org/{next_epoch_time}

+
+ +

Participants (please list yourself if you'd like to)

+ +
+ +

Topics

+ +
+ +

Tasks (strikethrough ^/โŒ˜ + 5 to mark as complete)

+ +
+ +

Recap

+
+
+

Here's the recap for today's/Saturday's dev sync ๐Ÿง‘โ€๐Ÿ’ปโ™ป๏ธ

+ + +
+ +

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}).

+ +
+

Nice outro ๐Ÿ˜Š

+ + """ + + # 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 + uses: fadenb/matrix-chat-message@v0.0.6 + with: + homeserver: "matrix.org" + token: ${{ secrets.MATRIX_SCRIBE_BOT_ACCESS_TOKEN }} + channel: ${{ secrets.MATRIX_GENERAL_ROOM_ID }} + 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/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: + + - Call link: https://call.element.io/room/#/scribe-dev-sync?roomId=!UddhHUSXxHAoAnImXb:call.ems.host&password=ASriEQCG4DE6Q1QSB313zig0bhLd62RN + - This week's pad: https://etherpad.wikimedia.org/p/scribe-dev-sync-${{ env.NEXT_BI_WEEKLY_DATE }} + - All Scribe pads: https://etherpad.wikimedia.org/p/scribe-dev-sync + + Please reply in the thread for this message with anything you'd like to discuss ๐Ÿงต + + Thanks and have a great day! ๐Ÿ’™