-
Notifications
You must be signed in to change notification settings - Fork 0
40 lines (38 loc) · 1.25 KB
/
PushToGitCode.yaml
File metadata and controls
40 lines (38 loc) · 1.25 KB
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
name: GitCode Push
on:
workflow_call:
inputs:
default_branch:
description: 'Default branch to push to GitCode'
required: false
type: string
default: 'master'
gitcode_username:
description: 'GitCode username for authentication'
required: true
type: string
gitcode_repository:
description: 'GitCode repository path (e.g., username/repo)'
required: false
type: string
default: ${{ vars.GITCODE_REPOSITORY || github.repository }}
secrets:
GITCODE_TOKEN:
description: 'GitCode access token'
required: true
jobs:
push_to_gitcode:
name: Push to GitCode
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v6
with:
fetch-depth: 0
ref: ${{ inputs.default_branch }}
- name: Push to GitCode
run: |
git config user.name "GitHub Actions"
git config user.email "github-actions@github.com"
git remote add gitcode https://${{ inputs.gitcode_username }}:${{ secrets.GITCODE_TOKEN }}@gitcode.com/${{ inputs.gitcode_repository }}.git
git push gitcode --tags --force ${{ inputs.default_branch }}:${{ inputs.default_branch }}