Skip to content
list

GitHub Action

Get Organization Repository Names

v3.1 Latest version

Get Organization Repository Names

list

Get Organization Repository Names

Get all an organization's repository names to do matrix builds

Installation

Copy and paste the following snippet into your .yml file.

              

- name: Get Organization Repository Names

uses: austenstone/[email protected]

Learn more about this action in austenstone/get-org-repos

Choose a version

Get Organization's Repositories

This is an Action to get all an organization's repositories by name.

The primary use case is for repeating a task for all the repositories in an organization.

⚠️ A job matrix can generate a maximum of 256 jobs per workflow run ⚠️

Default Workflow

name: Hello World

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  get-org-repos:
    runs-on: ubuntu-latest
    steps:
      - uses: austenstone/get-org-repos@main
        with:
          github-token: ${{ secrets.TOKEN }}
        id: get-org-repos
    outputs:
      repos: ${{ steps.get-org-repos.outputs.repos }}

  print:
    runs-on: ubuntu-latest
    needs: [get-org-repos]
    strategy:
      matrix:
        repo: ${{ fromJson(needs.get-org-repos.outputs.repos) }}
      fail-fast: false
    steps:
      - run: echo "Hello ${{ matrix.repo }}!"

Deliminate String Workflow

name: Hello World

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  get-org-repos:
    runs-on: ubuntu-latest
    steps:
      - uses: austenstone/get-org-repos@main
        with:
          github-token: ${{ secrets.TOKEN }}
          delimiter: '\n'
        id: get-org-repos
      - run: echo -e "${{ steps.get-org-repos.outputs.repos }}" > repos.txt
      - run: cat repos.txt

Git Workflow

name: Sync Repositories

on:
  push:
  pull_request:
  workflow_dispatch:

jobs:
  get-org-repos:
    runs-on: ubuntu-latest
    steps:
      - uses: austenstone/get-org-repos@main
        with:
          github-token: ${{ secrets.TOKEN }}
        id: get-org-repos
    outputs:
      repos: ${{ steps.get-org-repos.outputs.repos }}

  sync:
    needs:
      - get-org-repos
    runs-on: ubuntu-latest
    strategy:
      matrix:
        repo: ${{ fromJson(needs.get-org-repos.outputs.repos) }}
      fail-fast: false
    steps:
      - uses: actions/checkout@v3
        with:
          repository: ${{ github.event.organization.login }}/${{ matrix.repo }}
          token: ${{ secrets.TOKEN }}
      - run: ls -al

➡️ Input Settings

Various inputs are defined in action.yml:

Name Description Default
github‑token Token to use to authorize. ${{ github.token }}
org The organization name. ${{ github.event.organization.login }}
delimiter The delimiter to use when joining the names. N/A

Further help

To get more help on the Actions see documentation.