feat: initial version #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| --- | |
| name: Update Repositories List in Roadmap | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| organizations: | |
| description: 'GitHub organizations to fetch repositories from (comma-separated)' | |
| required: true | |
| default: 'LizardByte,LizardByte-infrastructure' | |
| schedule: | |
| - cron: '0 0 * * *' | |
| pull_request: | |
| branches: | |
| - master | |
| types: | |
| - opened | |
| - reopened | |
| - synchronize | |
| paths: | |
| - '.github/ISSUE_TEMPLATE/roadmap.yml' | |
| push: | |
| branches: | |
| - master | |
| paths: | |
| - '.github/workflows/update_issue_templates.yml' | |
| jobs: | |
| update-repositories: | |
| name: Update Repository List | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - 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" | |
| - name: Fetch repositories | |
| id: fetch_repos | |
| uses: actions/github-script@v7 | |
| with: | |
| github-token: ${{ secrets.GITHUB_TOKEN }} | |
| script: | | |
| const orgs = '${{ steps.get_orgs.outputs.orgs }}'.split(',').map(org => org.trim()); | |
| let allRepos = []; | |
| for (const org of orgs) { | |
| console.log(`Fetching repositories for organization: ${org}`); | |
| const opts = github.rest.repos.listForOrg.endpoint.merge({ | |
| org: org | |
| }); | |
| const repos = await github.paginate(opts); | |
| const activeRepos = repos | |
| .filter(repo => !repo.archived && !repo.disabled) | |
| .map(repo => repo.name); | |
| allRepos = [...allRepos, ...activeRepos]; | |
| } | |
| // Sort repositories alphabetically | |
| allRepos.sort(); | |
| console.log(`Found ${allRepos.length} repositories across ${orgs.length} organization(s)`); | |
| return allRepos; | |
| - name: Update repositories dropdown | |
| id: update_dropdown | |
| uses: ShaMan123/[email protected] | |
| with: | |
| form: .github/ISSUE_TEMPLATE/roadmap.yml | |
| dropdown: repositories | |
| options: ${{ steps.fetch_repos.outputs.result }} | |
| dry_run: no-push | |
| - name: Git Diff | |
| if: github.event_name == 'pull_request' | |
| run: git diff | |
| - name: Create/Update Pull Request | |
| if: github.event_name != 'pull_request' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| add-paths: | | |
| .github/ISSUE_TEMPLATE/*.yml | |
| token: ${{ secrets.GH_BOT_TOKEN }} | |
| commit-message: "chore: Update repositories list in roadmap.yml" | |
| branch: bot/update-repositories-list | |
| delete-branch: true | |
| title: "chore: Update repositories list in roadmap.yml" | |
| body: | | |
| This PR updates the list of repositories in the roadmap issue template. | |
| The list was automatically generated by a GitHub Action. | |
| labels: | | |
| auto-approve | |
| auto-merge |