Bibhu Mishra Claude Sonnet 4.6 commited on
Commit
8318a3b
Β·
1 Parent(s): abc493d

Clean up env vars and fix retrospective last-Sunday check

Browse files

- .env/.env.example: remove JWT_EXPIRES_IN, VITE_APP_NAME, HF_SPACE_URL, HF_TOKEN
(none are read by code; HF_TOKEN is a GitHub Actions secret only)
- retrospective/run_retrospective.py: use America/Chicago timezone in
is_last_sunday_of_month() so Mon-5AM-UTC cron is still Sunday in CST;
also honour FORCE_RUN env var to let admin workflow_dispatch bypass date check
- retrospective.yml: call script with --triggered-by flag (argparse, not sys.argv)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

.env.example CHANGED
@@ -11,17 +11,12 @@ DATABASE_URL=postgresql://user:pass@host/db?sslmode=require
11
 
12
  # ── NestJS API ───────────────────────────────────────────────────────────────
13
  JWT_SECRET=change-me-to-a-long-random-string
14
- JWT_EXPIRES_IN=7d
15
  API_PORT=3000
16
 
17
- # ── Vue UI (VITE_ prefix exposes vars to the browser) ────────────────────────
18
  VITE_API_URL=http://localhost:3000/api
19
 
20
- # ── HuggingFace Deployment ───────────────────────────────────────────────────
21
- HF_SPACE_URL=https://huggingface.co/spaces/<username>/<space-name>
22
- HF_TOKEN=hf_...
23
-
24
- # ── GitHub (artifacts + workflow dispatch) ───────────────────────────────────
25
  GITHUB_TOKEN=github_pat_...
26
  GITHUB_REPO=<owner>/<repo>
27
  ARTIFACTS_PATH=https://github.com/<owner>/<artifacts-repo>/<prefix>
 
11
 
12
  # ── NestJS API ───────────────────────────────────────────────────────────────
13
  JWT_SECRET=change-me-to-a-long-random-string
 
14
  API_PORT=3000
15
 
16
+ # ── Vue UI ───────────────────────────────────────────────────────────────────
17
  VITE_API_URL=http://localhost:3000/api
18
 
19
+ # ── GitHub (artifact storage + workflow dispatch) ─────────────────────────────
 
 
 
 
20
  GITHUB_TOKEN=github_pat_...
21
  GITHUB_REPO=<owner>/<repo>
22
  ARTIFACTS_PATH=https://github.com/<owner>/<artifacts-repo>/<prefix>
.github/workflows/retrospective.yml CHANGED
@@ -37,4 +37,4 @@ jobs:
37
  GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
38
  ARTIFACTS_PATH: ${{ secrets.ARTIFACTS_PATH }}
39
  FORCE_RUN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.force || 'false' }}
40
- run: python -m agents.retrospective.run_retrospective scheduler
 
37
  GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
38
  ARTIFACTS_PATH: ${{ secrets.ARTIFACTS_PATH }}
39
  FORCE_RUN: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.force || 'false' }}
40
+ run: python -m agents.retrospective.run_retrospective --triggered-by scheduler
agents/retrospective/run_retrospective.py CHANGED
@@ -18,13 +18,14 @@ from sqlalchemy import select
18
 
19
 
20
  def is_last_sunday_of_month() -> bool:
21
- today = date.today()
 
 
 
22
  if today.weekday() != 6: # 6 = Sunday
23
  return False
24
- # Is next Sunday in a different month?
25
- next_sunday = today.day + 7
26
  _, days_in_month = monthrange(today.year, today.month)
27
- return next_sunday > days_in_month
28
 
29
 
30
  def get_previous_month(today: date) -> tuple[int, int]:
@@ -105,4 +106,6 @@ if __name__ == "__main__":
105
  parser.add_argument("--force", action="store_true", help="Run regardless of date")
106
  parser.add_argument("--triggered-by", default="manual")
107
  args = parser.parse_args()
108
- main(args.triggered_by, args.force)
 
 
 
18
 
19
 
20
  def is_last_sunday_of_month() -> bool:
21
+ # Use CST/CDT β€” the cron fires Mon 5AM UTC which is still Sunday in Chicago
22
+ import pytz
23
+ chicago = pytz.timezone("America/Chicago")
24
+ today = datetime.now(chicago).date()
25
  if today.weekday() != 6: # 6 = Sunday
26
  return False
 
 
27
  _, days_in_month = monthrange(today.year, today.month)
28
+ return (today.day + 7) > days_in_month
29
 
30
 
31
  def get_previous_month(today: date) -> tuple[int, int]:
 
106
  parser.add_argument("--force", action="store_true", help="Run regardless of date")
107
  parser.add_argument("--triggered-by", default="manual")
108
  args = parser.parse_args()
109
+ # FORCE_RUN env var (set by GitHub Actions workflow_dispatch) overrides --force
110
+ force = args.force or os.getenv("FORCE_RUN", "false").lower() == "true"
111
+ main(args.triggered_by, force)