Skip to content

Commit f00e2cf

Browse files
committed
Added workflows action for count clone repository
1 parent 83ccc5a commit f00e2cf

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

.github/workflows/clone.yml

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
name: GitHub Clone Count for 14 days at every 6 hours
2+
3+
# Controls when the action will run.
4+
on:
5+
schedule:
6+
- cron: "0 */6 * * *"
7+
# Allows you to run this workflow manually from the Actions tab
8+
workflow_dispatch:
9+
10+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
11+
jobs:
12+
# This workflow contains a single job called "build"
13+
build:
14+
# The type of runner that the job will run on
15+
runs-on: ubuntu-latest
16+
17+
# Steps represent a sequence of tasks that will be executed as part of the job
18+
steps:
19+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
20+
- uses: actions/checkout@v2
21+
22+
- name: Parse clone count using REST API
23+
run: |
24+
curl --user "${{ github.actor }}:${{ secrets.SECRET_TOKEN }}" \
25+
-H "Accept: application/vnd.github.v3+json" \
26+
https://api.github.com/repos/${{ github.repository }}/traffic/clones \
27+
> clone.json
28+
29+
- name: Add to git repo
30+
run: |
31+
git add .
32+
git config --global user.name "GitHub Action"
33+
git config --global user.email "[email protected]"
34+
git commit -m "Automated clone.json update"
35+
36+
- name: Push
37+
uses: ad-m/github-push-action@master
38+
with:
39+
github_token: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)