Skip to content

Commit

Permalink
slack/sync: infer commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ryan-williams committed Feb 25, 2024
1 parent cd8b5f9 commit 5e14a82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ on:
description: "Update parquets (in this repo)"
default: true
update_slack_sha:
description: "\"Update NJSP data\" commit hash (for posting updates to Slack)"
description: "\"Refresh NJSP data\" commit hash (for posting updates to Slack)"
update_crash_log:
type: boolean
description: "Update crash log in AWS"
Expand Down
10 changes: 7 additions & 3 deletions njsp/cli/slack/sync.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import pandas as pd
from click import option, argument
from datetime import datetime as dt
from typing import Optional
from utz import err
from utz import err, process
from utz.ymd import dates, YMD

from .base import slack
from .channel_client import ChannelClient, CHANNEL_OPTS
from ...commit_crashes import crash_str, CommitCrashes
from ...crashes import Crash
from ...paths import fauqstats_relpath


def sync_crash(
Expand Down Expand Up @@ -59,8 +60,11 @@ def post_msg():
@option(*CHANNEL_OPTS, help='Slack channel ID to post to; defaults to $SLACK_CHANNEL_ID')
@option('-m', '--fetch-messages', type=int, default=1000, help="Fetch messages from Slack and update cache (as opposed to just reading cached messages")
@option('-n', '--dry-run', count=True, help="Avoid Slack API requests, cache updates, etc.")
@argument('commit')
@argument('commit', required=False)
def sync(commit, start: YMD, end: YMD, overwrite_existing, channel, fetch_messages: Optional[int], dry_run: int):
if not commit:
cur_year = dt.now().year
commit = process.line('git', 'log', '-1', '--format=%h', '--', fauqstats_relpath(cur_year), fauqstats_relpath(cur_year - 1))
cc = CommitCrashes(commit)
crashes = cc.adds_df

Expand Down

0 comments on commit 5e14a82

Please sign in to comment.