fix(docker): 添加安全目录配置以支持Git操作 #297
This file contains hidden or 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: sync2mirror | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - dev | |
| jobs: | |
| repo-sync: | |
| env: | |
| gitcode_key: ${{ secrets.GITCODE_PRIVATE_KEY }} | |
| gitcode_token: ${{ secrets.GITCODE_TOKEN }} | |
| gitcode_user: ${{ secrets.GITCODE_USER }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Mask sensitive values | |
| env: | |
| MASK_OWNER: ${{ github.repository_owner }} | |
| MASK_REPO: ${{ github.event.repository.name }} | |
| MASK_TARGET: ${{ secrets.GITCODE_REPO_NAME }} | |
| run: | | |
| echo "::add-mask::${MASK_OWNER}" | |
| echo "::add-mask::${MASK_REPO}" | |
| echo "::add-mask::${MASK_TARGET}" | |
| - name: sync | |
| if: env.gitcode_key && env.gitcode_token && env.gitcode_user | |
| run: | | |
| git remote remove upstream-mirror 2>/dev/null || true | |
| git remote add upstream-mirror "https://${GITCODE_USER}:${GITCODE_TOKEN}@gitcode.com/${GITCODE_USER}/${REPO_NAME}.git" | |
| git push --force --progress upstream-mirror "HEAD:${GITHUB_REF_NAME}" | |
| env: | |
| GITCODE_USER: ${{ secrets.GITCODE_USER }} | |
| GITCODE_TOKEN: ${{ secrets.GITCODE_TOKEN }} | |
| REPO_NAME: ${{ secrets.GITCODE_REPO_NAME }} |