From 278474d9a96e95ee7ce855a9065cb68f834d963e Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 6 Nov 2023 15:25:56 -0500 Subject: [PATCH 1/3] - updates agenda workflow so it closes older agenda issues automatically --- .github/workflows/agenda.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/agenda.yaml b/.github/workflows/agenda.yaml index b1f32e4477..3394c5a001 100644 --- a/.github/workflows/agenda.yaml +++ b/.github/workflows/agenda.yaml @@ -13,17 +13,25 @@ on: schedule: - cron: '0 16 * * 4' workflow_dispatch: {} - + +permissions: + issues: write + jobs: agenda: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TITLE_PREFIX: "Open Community (TDC) Meeting, " + LABEL: "Housekeeping" 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: gh issue create -l ${{ env.LABEL }} -t "${{ env.TITLE_PREFIX }}`date --date='next Thu' +'%A %d %B %Y'`" -F .github/templates/agenda.md + - 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]::Parse([regex]::Replace($_.title.Replace("${{ env.TITLE_PREFIX }}", ""), "\([^)]+\)", "")) -le [datetime]::UtcNow} | ForEach-Object { gh issue close $_.number } + shell: pwsh From 70eefd30ad654f79ea7ae649ef2efffe6f9fed0b Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 9 Nov 2023 14:00:37 -0500 Subject: [PATCH 2/3] - adds a delay before closing agenda issues - adds pinning and unpinning of agenda issues Signed-off-by: Vincent Biret --- .github/workflows/agenda.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/agenda.yaml b/.github/workflows/agenda.yaml index 3394c5a001..c7057d6b78 100644 --- a/.github/workflows/agenda.yaml +++ b/.github/workflows/agenda.yaml @@ -23,6 +23,7 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} TITLE_PREFIX: "Open Community (TDC) Meeting, " LABEL: "Housekeeping" + POST_MEETING_CLOSE_DURATION_IN_DAYS: 10 runs-on: ubuntu-latest @@ -30,8 +31,12 @@ jobs: - uses: actions/checkout@v4 # checkout repo content - name: Create agenda issue - run: gh issue create -l ${{ env.LABEL }} -t "${{ env.TITLE_PREFIX }}`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]::Parse([regex]::Replace($_.title.Replace("${{ env.TITLE_PREFIX }}", ""), "\([^)]+\)", "")) -le [datetime]::UtcNow} | ForEach-Object { gh issue close $_.number } + 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 From d2614f467c283f0a49fd49552ba7486073ee995a Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Thu, 9 Nov 2023 14:19:33 -0500 Subject: [PATCH 3/3] - adds missing contents permission Signed-off-by: Vincent Biret --- .github/workflows/agenda.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/agenda.yaml b/.github/workflows/agenda.yaml index c7057d6b78..3a87bcc2ee 100644 --- a/.github/workflows/agenda.yaml +++ b/.github/workflows/agenda.yaml @@ -16,6 +16,7 @@ on: permissions: issues: write + contents: read jobs: agenda: