diff --git a/.github/workflows/argoproj.yml b/.github/workflows/argoproj.yml index ef0da67..f97d410 100644 --- a/.github/workflows/argoproj.yml +++ b/.github/workflows/argoproj.yml @@ -32,13 +32,14 @@ jobs: gitee: argoproj steps: - - name: Cache src repo - uses: actions/cache@v3 - id: cache-src-repo + # https://github.com/actions/cache/blob/main/restore/README.md#outputs + - name: Restore cached repo + id: restore-cached-repo + uses: actions/cache/restore@v3 with: - path: ${{ github.workspace }}/git-mirrors-cache + path: | + ${{ github.workspace }}/git-mirrors-cache key: ${{ runner.os }}-${{ matrix.github }}-cache - restore-keys: ${{ runner.os }}-${{ matrix.github }}-cache - name: Organization ${{ matrix.github }} mirror if: ${{ always() }} @@ -67,3 +68,12 @@ jobs: else echo "empty" fi + + # https://github.com/actions/cache/blob/main/save/README.md + - name: Save repo cache + id: save-repo-cache + uses: actions/cache/save@v3 + with: + path: | + ${{ github.workspace }}/git-mirrors-cache + key: ${{ steps.restore-cached-repo.outputs.cache-primary-key }} diff --git a/.github/workflows/facebookresearch.yml b/.github/workflows/facebookresearch.yml deleted file mode 100644 index 6c65d0a..0000000 --- a/.github/workflows/facebookresearch.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: facebookresearch - -on: - workflow_dispatch: - inputs: - reason: - description: 'run action reason' - required: false - type: string - default: 'manually test' - schedule: - - cron: '5 0 */6 * *' - push: - branches: - - main - - dev - - bug/** - - fix/** - - bugfix/** - - feature/** - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - -jobs: - orgs: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - github: facebookresearch - gitee: facebookresearch - - steps: - - name: Cache src repo - uses: actions/cache@v3 - id: cache-src-repo - with: - path: ${{ github.workspace }}/git-mirrors-cache - key: ${{ runner.os }}-${{ matrix.github }}-cache - restore-keys: ${{ runner.os }}-${{ matrix.github }}-cache - - - name: Organization ${{ matrix.github }} mirror - if: ${{ always() }} - uses: x-actions/git-mirrors@main - with: - src: github/${{ matrix.github }} - src_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - dst: gitee/${{ matrix.gitee }} - dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} - dst_token: ${{ secrets.GITEE_TOKEN }} - account_type: org - clone_style: ssh - debug: true - - - name: Print cache path - continue-on-error: true - run: | - set -x - echo "whoami is `whoami`" - dir="${{ github.workspace }}/git-mirrors-cache" - if [ -d "${dir}" ]; then - sudo chmod a+r -R ${dir} - ls -lhart ${dir} - tree -L 2 ${dir} - du -lh -d 1 - else - echo "empty" - fi diff --git a/.github/workflows/influxdata.yml b/.github/workflows/influxdata.yml index 5ff8458..d097fd8 100644 --- a/.github/workflows/influxdata.yml +++ b/.github/workflows/influxdata.yml @@ -32,13 +32,14 @@ jobs: gitee: influxdata steps: - - name: Cache src repo - uses: actions/cache@v3 - id: cache-src-repo + # https://github.com/actions/cache/blob/main/restore/README.md#outputs + - name: Restore cached repo + id: restore-cached-repo + uses: actions/cache/restore@v3 with: - path: ${{ github.workspace }}/git-mirrors-cache + path: | + ${{ github.workspace }}/git-mirrors-cache key: ${{ runner.os }}-${{ matrix.github }}-cache - restore-keys: ${{ runner.os }}-${{ matrix.github }}-cache - name: Organization ${{ matrix.github }} mirror if: ${{ always() }} @@ -67,3 +68,12 @@ jobs: else echo "empty" fi + + # https://github.com/actions/cache/blob/main/save/README.md + - name: Save repo cache + id: save-repo-cache + uses: actions/cache/save@v3 + with: + path: | + ${{ github.workspace }}/git-mirrors-cache + key: ${{ steps.restore-cached-repo.outputs.cache-primary-key }} diff --git a/.github/workflows/istio.yml b/.github/workflows/istio.yml index 1eb6d97..840241c 100644 --- a/.github/workflows/istio.yml +++ b/.github/workflows/istio.yml @@ -32,13 +32,14 @@ jobs: gitee: x-istio steps: - - name: Cache src repo - uses: actions/cache@v3 - id: cache-src-repo + # https://github.com/actions/cache/blob/main/restore/README.md#outputs + - name: Restore cached repo + id: restore-cached-repo + uses: actions/cache/restore@v3 with: - path: ${{ github.workspace }}/git-mirrors-cache + path: | + ${{ github.workspace }}/git-mirrors-cache key: ${{ runner.os }}-${{ matrix.github }}-cache - restore-keys: ${{ runner.os }}-${{ matrix.github }}-cache - name: Organization ${{ matrix.github }} mirror if: ${{ always() }} @@ -67,3 +68,12 @@ jobs: else echo "empty" fi + + # https://github.com/actions/cache/blob/main/save/README.md + - name: Save repo cache + id: save-repo-cache + uses: actions/cache/save@v3 + with: + path: | + ${{ github.workspace }}/git-mirrors-cache + key: ${{ steps.restore-cached-repo.outputs.cache-primary-key }} diff --git a/.github/workflows/kubernetes.yml b/.github/workflows/kubernetes.yml deleted file mode 100644 index c10be5b..0000000 --- a/.github/workflows/kubernetes.yml +++ /dev/null @@ -1,69 +0,0 @@ -name: kubernetes - -on: - workflow_dispatch: - inputs: - reason: - description: 'run action reason' - required: false - type: string - default: 'manually test' - schedule: - - cron: '5 0 */6 * *' - push: - branches: - - main - - dev - - bug/** - - fix/** - - bugfix/** - - feature/** - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - -jobs: - orgs: - runs-on: ubuntu-latest - strategy: - matrix: - include: - - github: kubernetes - gitee: x-kubernetes - - steps: - - name: Cache src repo - uses: actions/cache@v3 - id: cache-src-repo - with: - path: ${{ github.workspace }}/git-mirrors-cache - key: ${{ runner.os }}-${{ matrix.github }}-cache - restore-keys: ${{ runner.os }}-${{ matrix.github }}-cache - - - name: Organization ${{ matrix.github }} mirror - if: ${{ always() }} - uses: x-actions/git-mirrors@main - with: - src: github/${{ matrix.github }} - src_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} - dst: gitee/${{ matrix.gitee }} - dst_key: ${{ secrets.GITEE_PRIVATE_KEY }} - dst_token: ${{ secrets.GITEE_TOKEN }} - account_type: org - clone_style: ssh - debug: true - - - name: Print cache path - continue-on-error: true - run: | - set -x - echo "whoami is `whoami`" - dir="${{ github.workspace }}/git-mirrors-cache" - if [ -d "${dir}" ]; then - sudo chmod a+r -R ${dir} - ls -lhart ${dir} - tree -L 2 ${dir} - du -lh -d 1 - else - echo "empty" - fi diff --git a/README.md b/README.md index 1a2f4e5..f65ade3 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ |Source|Target|Sync Account|Repo Count|Status| |:---|:---|:---|:---|:---| -|[github.com/argoproj](https://github.com/argoproj)|[gitee.com/argoproj](https://gitee.com/argoproj)|-|-|| -|[github.com/facebookresearch](https://github.com/facebookresearch)|[gitee.com/facebookresearch](https://gitee.com/facebookresearch)|-|-|| -|[github.com/influxdata](https://github.com/influxdata)|[gitee.com/influxdata](https://gitee.com/influxdata)|-|-|| -|[github.com/istio](https://github.com/istio)|[gitee.com/x-istio](https://gitee.com/x-istio)|-|-|| -|[github.com/kubernetes](https://github.com/kubernetes)|[gitee.com/x-kubernetes](https://gitee.com/x-kubernetes)|-|-|| +|[github.com/argoproj](https://github.com/argoproj)|[gitee.com/argoproj](https://gitee.com/argoproj)|-|-|[![github.com/argoproj](https://github.com/x-mirrors/gitee/actions/workflows/argoproj.yml/badge.svg)](https://github.com/x-mirrors/gitee/actions/workflows/argoproj.yml)| +|[github.com/facebookresearch](https://github.com/facebookresearch)|[gitee.com/facebookresearch](https://gitee.com/facebookresearch)|-|-|[![github.com/facebookresearch](https://github.com/x-mirrors/gitee/actions/workflows/facebookresearch.yml/badge.svg)](https://github.com/x-mirrors/gitee/actions/workflows/facebookresearch.yml)| +|[github.com/influxdata](https://github.com/influxdata)|[gitee.com/influxdata](https://gitee.com/influxdata)|-|-|[![github.com/influxdata](https://github.com/x-mirrors/gitee/actions/workflows/influxdata.yml/badge.svg)](https://github.com/x-mirrors/gitee/actions/workflows/influxdata.yml)| +|[github.com/istio](https://github.com/istio)|[gitee.com/x-istio](https://gitee.com/x-istio)|-|-|[![github.com/istio](https://github.com/x-mirrors/gitee/actions/workflows/istio.yml/badge.svg)](https://github.com/x-mirrors/gitee/actions/workflows/istio.yml)| +|[github.com/kubernetes](https://github.com/kubernetes)|[gitee.com/x-kubernetes](https://gitee.com/x-kubernetes)|-|-|[![github.com/kubernetes](https://github.com/x-mirrors/gitee/actions/workflows/kubernetes.yml/badge.svg)](https://github.com/x-mirrors/gitee/actions/workflows/kubernetes.yml)| ## 新增同步需求 diff --git a/hack/render.py b/hack/render.py index 8096ada..e63d05f 100644 --- a/hack/render.py +++ b/hack/render.py @@ -89,9 +89,13 @@ def readme(self): 'target': f'[gitee.com/{dest}](https://gitee.com/{dest})', 'sync_account': '-', 'repo_count': self.get_repo_count(src), - 'status': '', + 'status': f'[![github.com/{src}](https://github.com/x-mirrors/gitee/actions/workflows/{src}.yml/badge.svg)](https://github.com/x-mirrors/gitee/actions/workflows/{src}.yml)', }) + print(f'## {src} Mirror\n') + print(f'- sync from https://github.com/{src} by [x-mirrors/gitee](https://github.com/x-mirrors/gitee)') + print(f'- 其他同步需求:发送邮件到 `me@xiexianbin.cn` 或在 https://github.com/x-mirrors/gitee/ 提交 `issue`\n') + target_lines = sorted(target_lines, key=lambda x: x['source']) for i in target_lines: mk_lines.append( diff --git a/hack/sync.txt b/hack/sync.txt index a22d180..8e58610 100644 --- a/hack/sync.txt +++ b/hack/sync.txt @@ -1,6 +1,4 @@ # argoproj argoproj -facebookresearch facebookresearch influxdata influxdata istio x-istio -kubernetes x-kubernetes diff --git a/hack/sync.yml.tpl b/hack/sync.yml.tpl index 6e1e1c1..19f158e 100644 --- a/hack/sync.yml.tpl +++ b/hack/sync.yml.tpl @@ -32,13 +32,14 @@ jobs: gitee: {{ gitee_org }} {% raw %} steps: - - name: Cache src repo - uses: actions/cache@v3 - id: cache-src-repo + # https://github.com/actions/cache/blob/main/restore/README.md#outputs + - name: Restore cached repo + id: restore-cached-repo + uses: actions/cache/restore@v3 with: - path: ${{ github.workspace }}/git-mirrors-cache + path: | + ${{ github.workspace }}/git-mirrors-cache key: ${{ runner.os }}-${{ matrix.github }}-cache - restore-keys: ${{ runner.os }}-${{ matrix.github }}-cache - name: Organization ${{ matrix.github }} mirror if: ${{ always() }} @@ -67,4 +68,13 @@ jobs: else echo "empty" fi + + # https://github.com/actions/cache/blob/main/save/README.md + - name: Save repo cache + id: save-repo-cache + uses: actions/cache/save@v3 + with: + path: | + ${{ github.workspace }}/git-mirrors-cache + key: ${{ steps.restore-cached-repo.outputs.cache-primary-key }} {% endraw %}