Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/meeting.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@

Or in your local time:

* https://www.timeanddate.com/worldclock/?iso=<%= date.toZonedDateTimeISO('UTC').toPlainDateTime().toString() %>
* 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

## Agenda

Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ jobs:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm test
- run: npm run test:integration-issues

testint:
runs-on: ubuntu-latest
# only run if not a fork PR targeting main repo due to permissions
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) }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24
Expand All @@ -35,9 +38,13 @@ jobs:
- run: npm install
- run: npm run test:integration
env:
GITHUB_TOKEN: ${{ secrets.INT_TEST_TOKEN }}
GITHUB_TOKEN: ${{ secrets.INT_TEST_TOKEN != '' && secrets.INT_TEST_TOKEN || secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
GITHUB_HEAD_REPO: ${{ github.head_repo && github.head_repo.full_name || github.event.pull_request.head.repo.full_name || '' }}
action-in-action:
runs-on: ubuntu-latest
# only run if not a fork PR targeting main repo due to permissions
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) }}
steps:
- uses: actions/checkout@v4
- name: Use Node.js 24
Expand All @@ -47,6 +54,9 @@ jobs:
- run: npm install
- uses: ./
id: maker
env:
TEST_REPOS: ${{ github.repository != 'pkgjs/meet' && github.repository || 'pkgjs/meet,pkgjs/meet' }}
TEST_ORGS: ${{ github.repository != 'pkgjs/meet' && '' || 'pkgjs' }}
with:
token: ${{ secrets.GITHUB_TOKEN }}
schedules: 2020-04-02T17:00:00.0Z/P1D
Expand All @@ -56,7 +66,7 @@ jobs:
agendaLabel: meeting-agenda-test
meetingLink: https://github.com/pkgjs/meet
createNotes: true
repos: pkgjs/meet,pkgjs/meet
orgs: pkgjs
repos: ${{ env.TEST_REPOS }}
orgs: ${{ env.TEST_ORGS }}
- name: clean up issue
run: node ./test/_close-issue.js ${{ secrets.GITHUB_TOKEN }} ${{ steps.maker.outputs.issueNumber }}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ When using EJS templates for your meeting issues, the following data properties

Or in your local time:

* https://www.timeanddate.com/worldclock/?iso=<%= date.toZonedDateTimeISO('UTC').toPlainDateTime().toString() %>
* 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

## Agenda

Expand Down
57 changes: 57 additions & 0 deletions lib/agenda.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
'use strict'

/**
* get agenda issues and PRs from repositories
* @param {Object} client - GitHub client
* @param {Array} repos - array of objects with owner and repo properties
* @param {string} agendaLabel - label to filter issues and PRs by
* @returns {Promise<Array>} array of unique issues and PRs
*/
async function fetchAgendaItems (client, repos, agendaLabel) {
const agendaIssues = []

// deduplicate repos
const uniqueRepos = [...new Map(
repos.map(repo => [`${repo.owner}/${repo.repo}`, repo])
).values()]

for (const r of uniqueRepos) {
const _agendaIssues = await client.paginate('GET /repos/{owner}/{repo}/issues', {
owner: r.owner,
repo: r.repo,
state: 'open',
labels: agendaLabel,
per_page: 100
})

console.log(`Fetching issues for ${r.owner}/${r.repo}: Found ${_agendaIssues.length}`)

for (const i of _agendaIssues) {
console.log(`Adding Issue: ${i.url}`)
agendaIssues.push(i)
}

const _agendaPrs = (await client.paginate('GET /repos/{owner}/{repo}/pulls', {
owner: r.owner,
repo: r.repo,
state: 'open',
labels: agendaLabel,
per_page: 100
})).filter(pr => pr.labels.find(label => label.name === agendaLabel) &&
!(agendaIssues.find((i) => i.url === pr.url))) // workaround for flaky GH API/SDK behavior where sometimes the issue endpoint loads PRs

console.log(`Fetching PRs for ${r.owner}/${r.repo}: Found ${_agendaPrs.length}`)

for (const pr of _agendaPrs) {
console.log(`Adding PR: ${pr.url}`)
agendaIssues.push(pr)
}
}

console.log(`Found ${agendaIssues.length} total issues for agenda`)
return agendaIssues
}

module.exports = {
fetchAgendaItems
}
5 changes: 3 additions & 2 deletions lib/default-template.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict'

module.exports = ({ date, agendaIssues, agendaLabel, meetingNotes, owner, repo, meetingLink }) => {
module.exports = ({ date, agendaIssues, agendaLabel, meetingNotes, owner, repo, meetingLink, title }) => {
const timezones = [
'America/Los_Angeles',
'America/Denver',
Expand Down Expand Up @@ -37,7 +37,8 @@ ${timezones.map((zone) => {
}).join('\n')}

Or in your local time:
* https://www.timeanddate.com/worldclock/?iso=${date.toZonedDateTimeISO('UTC').toPlainDateTime().toString()}

* 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

## Agenda

Expand Down
Loading