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.
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 }}!"
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
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
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 |
To get more help on the Actions see documentation.