Skip to content

Commit 0870aeb

Browse files
authored
Merge pull request #3435 from baywet/feature/auto-close-agenda
- updates agenda workflow so it closes older agenda issues automatically
2 parents f73731d + d2614f4 commit 0870aeb

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

.github/workflows/agenda.yaml

+17-3
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,31 @@ on:
1313
schedule:
1414
- cron: '0 16 * * 4'
1515
workflow_dispatch: {}
16-
16+
17+
permissions:
18+
issues: write
19+
contents: read
20+
1721
jobs:
1822
agenda:
1923
env:
2024
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25+
TITLE_PREFIX: "Open Community (TDC) Meeting, "
26+
LABEL: "Housekeeping"
27+
POST_MEETING_CLOSE_DURATION_IN_DAYS: 10
2128

2229
runs-on: ubuntu-latest
2330

2431
steps:
25-
- uses: actions/checkout@v1 # checkout repo content
32+
- uses: actions/checkout@v4 # checkout repo content
2633

2734
- name: Create agenda issue
28-
run: gh issue create -l Housekeeping -t "Open Community (TDC) Meeting, `date --date='next Thu' +'%A %d %B %Y'`" -F .github/templates/agenda.md
35+
run: |
36+
$nextThursday = @(@(1..8) | % {$(Get-Date).AddDays($_)} | ? {$_.DayOfWeek -ieq "Thursday"})[0].ToString("dddd dd MMMM yyyy", [CultureInfo]::InvariantCulture)
37+
$result = gh issue create -l ${{ env.LABEL }} -t "${{ env.TITLE_PREFIX }}$nextThursday" -F .github/templates/agenda.md
38+
gh issue pin $result
39+
shell: pwsh
2940

41+
- name: Close old agenda issues
42+
run: gh issue list -l ${{ env.LABEL }} --author "app/github-actions" --json number,title | ConvertFrom-Json | Where-Object { $_.title -like "${{ env.TITLE_PREFIX }}*" -and ([datetime]::UtcNow - [datetime]::Parse([regex]::Replace($_.title.Replace("${{ env.TITLE_PREFIX }}", ""), "\([^)]+\)", ""))) -ge [timespan]::FromDays([int]::Parse("${{ env.POST_MEETING_CLOSE_DURATION_IN_DAYS }}"))} | ForEach-Object { gh issue close $_.number && gh issue unpin $_.number }
43+
shell: pwsh

0 commit comments

Comments
 (0)