From ced8e0952d5b268ead12be839f745f34ed87e2ad Mon Sep 17 00:00:00 2001 From: MuYunyun <328375795@qq.com> Date: Mon, 26 Oct 2020 13:02:30 +0800 Subject: [PATCH] chore: update github action --- .github/dependabot.yml | 13 +++++++ .github/workflows/greetings.yml | 13 +++++++ .github/workflows/traffic2badge.yml | 58 +++++++++++++++++++++++++++++ README.md | 2 +- 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/greetings.yml create mode 100644 .github/workflows/traffic2badge.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000..54947268 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,13 @@ +# see https://github.com/yi-Xu-0100/traffic-to-badge/blob/main/.github/dependabot.yml +version: 2 +updates: + # Enable version updates for npm + - package-ecosystem: 'npm' + directory: '/' + schedule: + interval: 'daily' + # Maintain dependencies for GitHub Actions + - package-ecosystem: 'github-actions' + directory: '/' + schedule: + interval: 'daily' diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml new file mode 100644 index 00000000..1a35382c --- /dev/null +++ b/.github/workflows/greetings.yml @@ -0,0 +1,13 @@ +name: Greetings + +on: [pull_request, issues] + +jobs: + greeting: + runs-on: ubuntu-latest + steps: + - uses: actions/first-interaction@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + issue-message: 'Welcome your first issue here, thanks' + pr-message: 'Welcome your first pr here, thanks' diff --git a/.github/workflows/traffic2badge.yml b/.github/workflows/traffic2badge.yml new file mode 100644 index 00000000..3cd2d322 --- /dev/null +++ b/.github/workflows/traffic2badge.yml @@ -0,0 +1,58 @@ +name: traffic2badge +on: + push: + branches: + - master + schedule: + - cron: '1 0 * * *' #UTC + +jobs: + run: + name: Make GitHub Traffic to Badge + runs-on: ubuntu-latest + steps: + - name: Checkout Code + uses: actions/checkout@v2.3.3 + + - name: Get Commit Message + id: message + uses: actions/github-script@v3.0.0 + env: + FULL_COMMIT_MESSAGE: '${{ github.event.head_commit.message }}' + with: + result-encoding: string + script: | + var message = `${process.env.FULL_COMMIT_MESSAGE}`; + core.info(message); + if (message != '') return message; + var time = new Date(Date.now()).toISOString(); + core.info(time); + return `Get traffic data at ${time}`; + + - name: Set Traffic + id: traffic + uses: yi-Xu-0100/traffic-to-badge@v1.1.5 + with: + my_token: ${{ secrets.TRAFFIC_TOKEN }} + #(default) static_list: ${{ github.repository }} + #(default) traffic_branch: traffic + #(default) views_color: brightgreen + #(default) clones_color: brightgreen + #(default) logo: github + + - name: Deploy + uses: peaceiris/actions-gh-pages@v3.7.3 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + publish_branch: ${{ steps.traffic.outputs.traffic_branch }} + publish_dir: ${{ steps.traffic.outputs.traffic_path }} + user_name: 'github-actions[bot]' + user_email: 'github-actions[bot]@users.noreply.github.com' + full_commit_message: ${{ steps.message.outputs.result }} + + - name: Show Traffic Data + run: | + echo ${{ steps.traffic.outputs.traffic_branch }} + echo ${{ steps.traffic.outputs.traffic_path }} + cd ${{ steps.traffic.outputs.traffic_path }} + ls -a diff --git a/README.md b/README.md index 652efa0f..280b2194 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![Build Status](https://travis-ci.org/MuYunyun/reactSPA.svg?branch=master) ![LICENSE MIT](https://img.shields.io/npm/l/express.svg) +![GitHub views](https://raw.githubusercontent.com/MuYunyun/reactSPA/traffic/traffic-reactSPA/views.svg) ![Build Status](https://travis-ci.org/MuYunyun/reactSPA.svg?branch=master) ![LICENSE MIT](https://img.shields.io/npm/l/express.svg) 该项目是对 React 技术栈以及前端工程化的相关实践。