Skip to content

Commit

Permalink
Merge pull request #3435 from baywet/feature/auto-close-agenda
Browse files Browse the repository at this point in the history
- updates agenda workflow so it closes older agenda issues automatically
  • Loading branch information
earth2marsh authored Nov 16, 2023
2 parents f73731d + d2614f4 commit 0870aeb
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions .github/workflows/agenda.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,31 @@ on:
schedule:
- cron: '0 16 * * 4'
workflow_dispatch: {}


permissions:
issues: write
contents: read

jobs:
agenda:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TITLE_PREFIX: "Open Community (TDC) Meeting, "
LABEL: "Housekeeping"
POST_MEETING_CLOSE_DURATION_IN_DAYS: 10

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1 # checkout repo content
- uses: actions/checkout@v4 # checkout repo content

- name: Create agenda issue
run: gh issue create -l Housekeeping -t "Open Community (TDC) Meeting, `date --date='next Thu' +'%A %d %B %Y'`" -F .github/templates/agenda.md
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 0870aeb

Please sign in to comment.