Skip to content

Commit e7c0071

Browse files
authored
Merge branch 'main' into template-test
2 parents ed8f695 + d33fcc1 commit e7c0071

File tree

11 files changed

+383
-118
lines changed

11 files changed

+383
-118
lines changed

.github/ISSUE_TEMPLATE/meeting.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
Or in your local time:
3636

37-
* https://www.timeanddate.com/worldclock/?iso=<%= date.toZonedDateTimeISO('UTC').toPlainDateTime().toString() %>
37+
* https://www.timeanddate.com/worldclock/fixedtime.html?msg=<%= encodeURIComponent(title) %>&iso=<%= date.toZonedDateTimeISO('UTC').toPlainDateTime().toString().slice(0, 16).replace(/[-:]/g, '') %>&p1=1440&ah=1
3838

3939
## Agenda
4040

.github/workflows/test.yml

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ jobs:
2323
node-version: ${{ matrix.node-version }}
2424
- run: npm install
2525
- run: npm test
26+
- run: npm run test:integration-issues
2627

2728
test-templates:
2829
runs-on: ubuntu-latest
@@ -37,6 +38,8 @@ jobs:
3738

3839
testint:
3940
runs-on: ubuntu-latest
41+
# only run if not a fork PR targeting main repo due to permissions
42+
if: ${{ !(github.head_repo || github.event.pull_request.head.repo) || github.repository == (github.head_repo.full_name || github.event.pull_request.head.repo.full_name) }}
4043
steps:
4144
- uses: actions/checkout@v4
4245
- name: Use Node.js 24
@@ -46,10 +49,13 @@ jobs:
4649
- run: npm install
4750
- run: npm run test:integration
4851
env:
49-
GITHUB_TOKEN: ${{ secrets.INT_TEST_TOKEN }}
50-
52+
GITHUB_TOKEN: ${{ secrets.INT_TEST_TOKEN != '' && secrets.INT_TEST_TOKEN || secrets.GITHUB_TOKEN }}
53+
GITHUB_REPOSITORY: ${{ github.repository }}
54+
GITHUB_HEAD_REPO: ${{ github.head_repo && github.head_repo.full_name || github.event.pull_request.head.repo.full_name || '' }}
5155
action-in-action:
5256
runs-on: ubuntu-latest
57+
# only run if not a fork PR targeting main repo due to permissions
58+
if: ${{ !(github.head_repo || github.event.pull_request.head.repo) || github.repository == (github.head_repo.full_name || github.event.pull_request.head.repo.full_name) }}
5359
steps:
5460
- uses: actions/checkout@v4
5561
- name: Use Node.js 24
@@ -59,6 +65,9 @@ jobs:
5965
- run: npm install
6066
- uses: ./
6167
id: maker
68+
env:
69+
TEST_REPOS: ${{ github.repository != 'pkgjs/meet' && github.repository || 'pkgjs/meet,pkgjs/meet' }}
70+
TEST_ORGS: ${{ github.repository != 'pkgjs/meet' && '' || 'pkgjs' }}
6271
with:
6372
token: ${{ secrets.GITHUB_TOKEN }}
6473
schedules: 2020-04-02T17:00:00.0Z/P1D
@@ -68,7 +77,7 @@ jobs:
6877
agendaLabel: meeting-agenda-test
6978
meetingLink: https://github.com/pkgjs/meet
7079
createNotes: true
71-
repos: pkgjs/meet,pkgjs/meet
72-
orgs: pkgjs
80+
repos: ${{ env.TEST_REPOS }}
81+
orgs: ${{ env.TEST_ORGS }}
7382
- name: clean up issue
7483
run: node ./test/_close-issue.js ${{ secrets.GITHUB_TOKEN }} ${{ steps.maker.outputs.issueNumber }}

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ When using EJS templates for your meeting issues, the following data properties
167167
168168
Or in your local time:
169169
170-
* https://www.timeanddate.com/worldclock/?iso=<%= date.toZonedDateTimeISO('UTC').toPlainDateTime().toString() %>
170+
* https://www.timeanddate.com/worldclock/fixedtime.html?msg=<%= encodeURIComponent(title) %>&iso=<%= date.toZonedDateTimeISO('UTC').toPlainDateTime().toString().slice(0, 16).replace(/[-:]/g, '') %>&p1=1440&ah=1
171171
172172
## Agenda
173173

lib/agenda.js

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
'use strict'
2+
3+
/**
4+
* get agenda issues and PRs from repositories
5+
* @param {Object} client - GitHub client
6+
* @param {Array} repos - array of objects with owner and repo properties
7+
* @param {string} agendaLabel - label to filter issues and PRs by
8+
* @returns {Promise<Array>} array of unique issues and PRs
9+
*/
10+
async function fetchAgendaItems (client, repos, agendaLabel) {
11+
const agendaIssues = []
12+
13+
// deduplicate repos
14+
const uniqueRepos = [...new Map(
15+
repos.map(repo => [`${repo.owner}/${repo.repo}`, repo])
16+
).values()]
17+
18+
for (const r of uniqueRepos) {
19+
const _agendaIssues = await client.paginate('GET /repos/{owner}/{repo}/issues', {
20+
owner: r.owner,
21+
repo: r.repo,
22+
state: 'open',
23+
labels: agendaLabel,
24+
per_page: 100
25+
})
26+
27+
console.log(`Fetching issues for ${r.owner}/${r.repo}: Found ${_agendaIssues.length}`)
28+
29+
for (const i of _agendaIssues) {
30+
console.log(`Adding Issue: ${i.url}`)
31+
agendaIssues.push(i)
32+
}
33+
34+
const _agendaPrs = (await client.paginate('GET /repos/{owner}/{repo}/pulls', {
35+
owner: r.owner,
36+
repo: r.repo,
37+
state: 'open',
38+
labels: agendaLabel,
39+
per_page: 100
40+
})).filter(pr => pr.labels.find(label => label.name === agendaLabel) &&
41+
!(agendaIssues.find((i) => i.url === pr.url))) // workaround for flaky GH API/SDK behavior where sometimes the issue endpoint loads PRs
42+
43+
console.log(`Fetching PRs for ${r.owner}/${r.repo}: Found ${_agendaPrs.length}`)
44+
45+
for (const pr of _agendaPrs) {
46+
console.log(`Adding PR: ${pr.url}`)
47+
agendaIssues.push(pr)
48+
}
49+
}
50+
51+
console.log(`Found ${agendaIssues.length} total issues for agenda`)
52+
return agendaIssues
53+
}
54+
55+
module.exports = {
56+
fetchAgendaItems
57+
}

lib/default-template.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
'use strict'
22

3-
module.exports = ({ date, agendaIssues, agendaLabel, meetingNotes, owner, repo, meetingLink }) => {
3+
module.exports = ({ date, agendaIssues, agendaLabel, meetingNotes, owner, repo, meetingLink, title }) => {
44
const timezones = [
55
'America/Los_Angeles',
66
'America/Denver',
@@ -38,7 +38,7 @@ ${timezones.map((zone) => {
3838
3939
Or in your local time:
4040
41-
* https://www.timeanddate.com/worldclock/?iso=${date.toZonedDateTimeISO('UTC').toPlainDateTime().toString()}
41+
* https://www.timeanddate.com/worldclock/fixedtime.html?msg=${encodeURIComponent(title)}&iso=${date.toZonedDateTimeISO('UTC').toPlainDateTime().toString().slice(0, 16).replace(/[-:]/g, '')}&p1=1440&ah=1
4242
4343
## Agenda
4444

0 commit comments

Comments
 (0)