-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add schedules for sapphire ceremony reminders
- Loading branch information
1 parent
9962790
commit a0bec3b
Showing
7 changed files
with
123 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Sapphire On Call Retro | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "45 14 * * THURS" | ||
|
||
jobs: | ||
check_and_notify: | ||
runs-on: ubuntu-latest | ||
outputs: | ||
should_run: ${{ steps.check_run_condition.outputs.should_run }} | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
|
||
- name: Check if retro is today | ||
id: check_run_condition | ||
run: | | ||
result=$(python3 sapphire/utils/is_retro_today.py) | ||
echo "::set-output name=should_run::$result" | ||
sapphire-on-call-retro: | ||
needs: check_and_notify | ||
if: needs.check_and_notify.outputs.should_run == 'true' | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Setup Node.JS | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "12" | ||
|
||
- name: Install Dependencies | ||
run: npm install --global @artsy/cli | ||
|
||
- name: Run CLI | ||
id: cli | ||
run: echo "PAYLOAD=$(artsy scheduled:sapphire-on-call-retro)" >> "$GITHUB_OUTPUT" | ||
env: | ||
OPSGENIE_API_KEY: ${{ secrets.OPSGENIE_API_KEY }} | ||
SLACK_WEB_API_TOKEN: ${{ secrets.SLACK_WEB_API_TOKEN }} | ||
|
||
- name: Standup Reminder > Slack | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: custom | ||
custom_payload: ${{steps.cli.outputs.PAYLOAD}} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
name: Sapphire On Call | ||
|
||
on: | ||
workflow_dispatch: | ||
schedule: | ||
- cron: "45 14 * * MON" | ||
|
||
jobs: | ||
sapphire-on-call: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 10 | ||
|
||
steps: | ||
- name: Setup Node.JS | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: "12" | ||
|
||
- name: Install Dependencies | ||
run: npm install --global @artsy/cli | ||
|
||
- name: Run CLI | ||
id: cli | ||
run: echo "PAYLOAD=$(artsy scheduled:sapphire-on-call)" >> "$GITHUB_OUTPUT" | ||
env: | ||
OPSGENIE_API_KEY: ${{ secrets.OPSGENIE_API_KEY }} | ||
SLACK_WEB_API_TOKEN: ${{ secrets.SLACK_WEB_API_TOKEN }} | ||
|
||
- name: Standup Reminder > Slack | ||
uses: 8398a7/action-slack@v3 | ||
with: | ||
status: custom | ||
custom_payload: ${{steps.cli.outputs.PAYLOAD}} | ||
env: | ||
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,3 +54,8 @@ node_modules/ | |
|
||
# macOS | ||
.DS_Store | ||
|
||
# python | ||
__pycache__/ | ||
.pytest_cache/ | ||
.python-version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
freezegun==1.4.0 | ||
pytest==8.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
from freezegun import freeze_time | ||
from utils.is_retro_today import is_retro_today | ||
|
||
|
||
@freeze_time("2024-04-11") | ||
def test_is_retro_today_returns_false_when_not_retro(): | ||
assert not is_retro_today() | ||
|
||
|
||
@freeze_time("2024-04-18") | ||
def test_is_retro_today_returns_true_when_retro(): | ||
assert is_retro_today() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from datetime import datetime | ||
|
||
|
||
def is_retro_today(): | ||
start_date = datetime(2024, 4, 4) | ||
today = datetime.now() | ||
week_diff = (today - start_date).days / 7 | ||
return week_diff % 2 == 0 | ||
|
||
|
||
if __name__ == "__main__": | ||
if is_retro_today(): | ||
print("true") | ||
else: | ||
print("false") |