Skip to content

Commit c3d8672

Browse files
authored
ci: use env vars for DRY workflow config (anomalyco#6395)
1 parent fe8ef04 commit c3d8672

2 files changed

Lines changed: 15 additions & 8 deletions

File tree

.github/workflows/docs-update.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
- cron: "0 */12 * * *"
66
workflow_dispatch:
77

8+
env:
9+
LOOKBACK_HOURS: 4
10+
811
jobs:
912
update-docs:
1013
if: github.repository == 'sst/opencode'
@@ -25,9 +28,9 @@ jobs:
2528
- name: Get recent commits
2629
id: commits
2730
run: |
28-
COMMITS=$(git log --since="4 hours ago" --pretty=format:"- %h %s" 2>/dev/null || echo "")
31+
COMMITS=$(git log --since="${{ env.LOOKBACK_HOURS }} hours ago" --pretty=format:"- %h %s" 2>/dev/null || echo "")
2932
if [ -z "$COMMITS" ]; then
30-
echo "No commits in the last 4 hours"
33+
echo "No commits in the last ${{ env.LOOKBACK_HOURS }} hours"
3134
echo "has_commits=false" >> $GITHUB_OUTPUT
3235
else
3336
echo "has_commits=true" >> $GITHUB_OUTPUT
@@ -47,7 +50,7 @@ jobs:
4750
model: opencode/gpt-5.2
4851
agent: docs
4952
prompt: |
50-
Review the following commits from the last 4 hours and identify any new features that may need documentation.
53+
Review the following commits from the last ${{ env.LOOKBACK_HOURS }} hours and identify any new features that may need documentation.
5154
5255
<recent_commits>
5356
${{ steps.commits.outputs.list }}

.github/workflows/stale-issues.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
- cron: "30 1 * * *" # Daily at 1:30 AM
66
workflow_dispatch:
77

8+
env:
9+
DAYS_BEFORE_STALE: 90
10+
DAYS_BEFORE_CLOSE: 7
11+
812
jobs:
913
stale:
1014
runs-on: ubuntu-latest
@@ -13,17 +17,17 @@ jobs:
1317
steps:
1418
- uses: actions/stale@v10
1519
with:
16-
days-before-stale: 90
17-
days-before-close: 7
20+
days-before-stale: ${{ env.DAYS_BEFORE_STALE }}
21+
days-before-close: ${{ env.DAYS_BEFORE_CLOSE }}
1822
stale-issue-label: "stale"
1923
close-issue-message: |
20-
[automated] Closing due to 90+ days of inactivity.
24+
[automated] Closing due to ${{ env.DAYS_BEFORE_STALE }}+ days of inactivity.
2125
2226
Feel free to reopen if you still need this!
2327
stale-issue-message: |
24-
[automated] This issue has had no activity for 90 days.
28+
[automated] This issue has had no activity for ${{ env.DAYS_BEFORE_STALE }} days.
2529
26-
It will be closed in 7 days if there's no new activity.
30+
It will be closed in ${{ env.DAYS_BEFORE_CLOSE }} days if there's no new activity.
2731
remove-stale-when-updated: true
2832
exempt-issue-labels: "pinned,security,feature-request,on-hold"
2933
start-date: "2025-12-27"

0 commit comments

Comments
 (0)