Skip to content
Merged
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
54 changes: 38 additions & 16 deletions .github/workflows/update_issue_templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ on:
workflow_dispatch:
inputs:
organizations:
description: 'GitHub organizations to fetch repositories from (comma-separated)'
required: true
default: 'LizardByte,LizardByte-infrastructure'
description: 'Optional comma-separated organizations; leave empty to use the shared organization registry'
required: false
schedule:
- cron: '0 0 * * *'
pull_request:
Expand All @@ -28,38 +27,60 @@ jobs:

- name: Get organizations
id: get_orgs
run: |
if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then
ORGS="${{ github.event.inputs.organizations }}"
else
ORGS="LizardByte,LizardByte-infrastructure" # Default organizations
fi
echo "orgs=$ORGS" >> "${GITHUB_OUTPUT}"
echo "Organizations to process: $ORGS"
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ORGANIZATIONS: ${{ inputs.organizations }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const override = (process.env.ORGANIZATIONS || '').trim();
let orgs;
if (override) {
orgs = override.split(',').map(org => org.trim()).filter(Boolean);
} else {
const {data} = await github.rest.repos.getContent({
owner: 'LizardByte',
repo: '.github',
path: 'organizations.json',
ref: 'master'
});
orgs = JSON.parse(Buffer.from(data.content, 'base64').toString('utf8'));
}

if (!Array.isArray(orgs) || orgs.length === 0 ||
orgs.some(org => typeof org !== 'string' || !org.trim())) {
throw new Error('Organizations must be a non-empty array of organization names');
}
orgs = [...new Set(orgs.map(org => org.trim()))];
console.log(`Organizations to process: ${orgs.join(', ')}`);
return orgs;

- name: Fetch repositories
id: fetch_repos
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
env:
ORGANIZATIONS: ${{ steps.get_orgs.outputs.result }}
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const orgs = '${{ steps.get_orgs.outputs.orgs }}'.split(',').map(org => org.trim());
const orgs = JSON.parse(process.env.ORGANIZATIONS);
let allRepos = [];

for (const org of orgs) {
try {
console.log(`Fetching repositories for organization: ${org}`);

const opts = github.rest.repos.listForOrg.endpoint.merge({
org: org
org: org,
per_page: 100
});

const repos = await github.paginate(opts);
console.log(`Successfully fetched ${repos.length} repositories from ${org}`);

const activeRepos = repos
.filter(repo => !repo.archived)
.map(repo => `${org}/${repo.name}`);
.map(repo => repo.full_name);

console.log(`Found ${activeRepos.length} active repositories for ${org}`);
allRepos = [...allRepos, ...activeRepos];
Expand All @@ -69,8 +90,9 @@ jobs:
}
}

// Sort repositories alphabetically
allRepos.sort();
// Keep each canonical org/repo label once and ignore capitalization when sorting.
allRepos = [...new Set(allRepos)];
allRepos.sort((left, right) => left.localeCompare(right, 'en', {sensitivity: 'base'}));

console.log(`Found ${allRepos.length} repositories across ${orgs.length} organization(s)`);
return allRepos;
Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ To add a new roadmap item:
4. Fill out all required fields

The repository list in the issue template is automatically updated daily with all active repositories across
the LizardByte organizations.
the organizations in
[LizardByte's organization registry](https://github.com/LizardByte/.github/blob/master/organizations.json).
Repository labels use `organization/repository` and are sorted alphabetically without regard to capitalization.
Manual workflow runs can optionally override the organizations with a comma-separated list.

## For the Community

Expand Down
Loading