Also run on update of the current repo #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: List READMEs | |
on: | |
push: | |
branches: | |
- main | |
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 to -- gh api orgs/$ORG_NAME/repos --paginate | jq -r '.[].name' -- " | |
REPOS=$(gh api orgs/$ORG_NAME/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 |