Skip to content

Latest commit

 

History

History
108 lines (91 loc) · 2.75 KB

README.md

File metadata and controls

108 lines (91 loc) · 2.75 KB

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.