Skip to content

Commit

Permalink
Test 'list readmes' in organisation
Browse files Browse the repository at this point in the history
Test 'list readmes' in organisation
  • Loading branch information
ZzAve committed Jan 5, 2024
1 parent d8e11e4 commit b635af2
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/list-readmes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: List READMEs

on:
workflow_dispatch:

env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

jobs:
list-readmes:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Get organization repositories
run: |
ORG_NAME="flock-community"
REPO_NAME="$(basename "$(pwd)")"
echo "Current repo: $REPO_NAME"
echo "Trying 'gh repo list $ORG_NAME --json name -q ".name != '$REPO_NAME'" --limit 1000'"
# REPOS=$(gh repo list $ORG_NAME --json name -q ".name != '$REPO_NAME'" --limit 1000)
REPOS=$(gh api orgs/your-org/repos --paginate | jq -r '.[].name')

echo "$REPOS" > repos.txt

- name: List first line of README for each repository
run: |
while IFS= read -r repo; do
REPO_NAME=$(echo $repo | jq -r .name)
echo "Repository: $REPO_NAME
README_FIRST_LINE=$(gh repo view $ORG_NAME/$REPO_NAME --json files -q '.files."README.md".content' | base64 -d | head -n 3)
echo "Repository: $REPO_NAME - First Line of README: $README_FIRST_LINE"
echo "---"
done < repos.txt

0 comments on commit b635af2

Please sign in to comment.