Skip to content

Commit

Permalink
- fixes a bug where the agenda automation would hit the 3 pinned item…
Browse files Browse the repository at this point in the history
…s limitation
  • Loading branch information
baywet committed Dec 7, 2023
1 parent b02c548 commit 761f3f1
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions .github/workflows/agenda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,16 @@ 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)
$result = gh issue create -l ${{ env.LABEL }} -t "${{ env.TITLE_PREFIX }}$nextThursday" -F .github/templates/agenda.md
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

0 comments on commit 761f3f1

Please sign in to comment.