Skip to content

Commit

Permalink
Update to fetch first 3 lines of the readme file
Browse files Browse the repository at this point in the history
  • Loading branch information
ZzAve authored Jan 5, 2024
1 parent c42825b commit 2a1645f
Showing 1 changed file with 18 additions and 12 deletions.
30 changes: 18 additions & 12 deletions .github/workflows/list-readmes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,23 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up Git credentials
run: echo "machine github.com login ${{ secrets.GITHUB_TOKEN }}" > ~/.netrc

- name: List READMEs
- name: Get organization repositories
run: |
# Get a list of repositories in the organization
repos=$(gh api orgs/flock-community/repos --paginate | jq -r '.[].name')
echo "$repos"
# Loop through each repository and print the first line of its README
for repo in $repos; do
readme_first_line=$(head -n 1 $repo/README.md 2>/dev/null)
echo "$repo: $readme_first_line"
done
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ORG_NAME="flock-community"
REPO_NAME="$(basename "$(pwd)")"
echo "Current repo: $REPO_NAME"
REPOS=$(gh repo list $ORG_NAME --json name -q ".name != '$REPO_NAME'" --limit 1000)
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 2a1645f

Please sign in to comment.