Create E20241101 Ubuntu user init.md #194
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: directory list | |
on: | |
push: | |
branches: | |
- main | |
issues: | |
types: [ opened, closed ] | |
jobs: | |
update: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
- name: Append directory tree to README | |
run: | | |
# Create readme | |
sudo apt-get install tree | |
sudo rm -rf README.md | |
touch README.md | |
git add README.md | |
echo "# Daily notes " > README.md | |
# Opened issue | |
echo "### Opened issues" >> README.md | |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues?state=open" \ | |
| jq -r '.[] | .title' | sed 's/^/- /' >> README.md | |
echo "" >> README.md | |
# Closed issue | |
echo "### Closed issue" >> README.md | |
curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
-H "Accept: application/vnd.github.v3+json" \ | |
"https://api.github.com/repos/${{ github.repository }}/issues?state=closed" \ | |
| jq -r '.[] | .title' | sed 's/^/- /' >> README.md | |
# My articles | |
echo "### Index" >> README.md | |
tree --dirsfirst --noreport -I README.md | sed 's/^/ /' >> README.md | |
- name: push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Actions" | |
git add . | |
git commit -m "Update README with directory list" | |
git push origin main |