From 761f3f1cb81a7820b7620159f9ee80678ac1418c Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 7 Dec 2023 14:39:29 -0500 Subject: [PATCH] - fixes a bug where the agenda automation would hit the 3 pinned items limitation --- .github/workflows/agenda.yaml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/agenda.yaml b/.github/workflows/agenda.yaml index 3a87bcc2ee..0f071c92e3 100644 --- a/.github/workflows/agenda.yaml +++ b/.github/workflows/agenda.yaml @@ -31,6 +31,11 @@ jobs: steps: - uses: actions/checkout@v4 # checkout repo content + # we want to close old agenda issues before creating a new one because there's a limit of 3 pinned items on a repo + - name: Close old agenda issues + 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 } + shell: pwsh + - name: Create agenda issue run: | $nextThursday = @(@(1..8) | % {$(Get-Date).AddDays($_)} | ? {$_.DayOfWeek -ieq "Thursday"})[0].ToString("dddd dd MMMM yyyy", [CultureInfo]::InvariantCulture) @@ -38,6 +43,4 @@ jobs: gh issue pin $result shell: pwsh - - name: Close old agenda issues - 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 } - shell: pwsh +