-
Notifications
You must be signed in to change notification settings - Fork 0
50 lines (47 loc) · 1.71 KB
/
print_tree.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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