Skip to content

Commit

Permalink
feat: support multiple repos for agenda issues
Browse files Browse the repository at this point in the history
  • Loading branch information
wesleytodd committed Feb 19, 2024
1 parent 3d7b0be commit a13fb7c
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 14 deletions.
15 changes: 8 additions & 7 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x]
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v1
- uses: actions/checkout@v4
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
Expand All @@ -23,11 +23,11 @@ jobs:
action-in-action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Use Node.js 16.x
uses: actions/setup-node@v1
- uses: actions/checkout@v4
- name: Use Node.js 18.x
uses: actions/setup-node@v4
with:
node-version: 16.x
node-version: 18.x
- run: npm install
- uses: ./
id: maker
Expand All @@ -39,5 +39,6 @@ jobs:
meetingLabels: testMeeting, test
agendaLabel: meeting-agenda-test
createNotes: true
repos: pkgjs/meet,pkgjs/meet
- name: clean up issue
run: node ./test/_close-issue.js ${{ secrets.GITHUB_TOKEN }} ${{ steps.maker.outputs.issueNumber }}
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ inputs:
description: 'A name of an issue template (found in .github/meet)'
default: 'notes.md'
required: false
repos:
description: 'An optional list of repos in the format: <org>/<repo>,<org>/<repo>'
required: false
outputs:
issueNumber:
description: 'If an issue was created, this will be its number'
Expand Down
31 changes: 24 additions & 7 deletions run.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,19 @@ const conversions = require('./lib/conversions')
const createNotes = core.getInput('createNotes')
const notesUserTemplate = core.getInput('notesTemplate')

let repos = core.getInput('repos')
if (repos) {
repos = repos.split(',').map((str) => {
const parts = str.split('/')
return {
owner: parts[0],
repo: parts[1]
}
})
} else {
repos = [github.context.repo]
}

const repo = github.context.repo
const client = new github.GitHub(token)

Expand All @@ -44,7 +57,7 @@ const conversions = require('./lib/conversions')
...repo,
template: issueTemplate
})
template = conversions.covnert(userProvidedIssueTemplate)
template = conversions.convert(userProvidedIssueTemplate)
template = ejs.compile(userProvidedIssueTemplate)
} catch (error) {
console.error(`template missing or invalid (${issueTemplate}): ${error.message}`)
Expand All @@ -60,12 +73,16 @@ const conversions = require('./lib/conversions')
}
}

const agendaIssues = (await client.issues.listForRepo({
owner: repo.owner,
repo: repo.repo,
state: 'open',
labels: agendaLabel
})).data || []
let agendaIssues = []
for (const r of repos) {
const _agendaIssues = (await client.issues.listForRepo({
owner: r.owner,
repo: r.repo,
state: 'open',
labels: agendaLabel
})).data || []
agendaIssues = agendaIssues.concat(_agendaIssues)
}
const opts = {
...repo,
schedules,
Expand Down

0 comments on commit a13fb7c

Please sign in to comment.