Skip to content

Commit 6217f32

Browse files
committed
feat: update env
Signed-off-by: QuentinN42 <[email protected]>
1 parent bf5c60b commit 6217f32

File tree

3 files changed

+25
-25
lines changed

3 files changed

+25
-25
lines changed

.github/workflows/commit-sync.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ jobs:
1515
- name: Checkout repository
1616
uses: actions/checkout@v4
1717
with:
18-
token: ${{ secrets.GITHUB_TOKEN }}
18+
token: ${{ secrets.GH_TOKEN }}
1919
fetch-depth: 0
2020
- name: Run commit sync
2121
env:
22-
GITLAB_USERNAME: ${{ secrets.GITLAB_USERNAME }}
23-
REPOSITORY: ${{ secrets.REPOSITORY }}
24-
GITHUB_USERNAME: ${{ secrets.GITHUB_USERNAME }}
25-
GITHUB_EMAIL: ${{ secrets.GITHUB_EMAIL }}
22+
GL_USERNAME: ${{ secrets.GL_USERNAME }}
23+
GH_REPOSITORY: ${{ secrets.GH_REPOSITORY }}
24+
GH_USERNAME: ${{ secrets.GH_USERNAME }}
25+
GH_EMAIL: ${{ secrets.GH_EMAIL }}
2626
run: ./script.sh

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,20 @@ The GitHub Action will:
1919
1. Fork this repository
2020
2. Go to your fork's Settings → Secrets and variables → Actions
2121
3. Add the following secrets:
22-
- `GITLAB_USERNAME`: Your GitLab username
23-
- `REPOSITORY`: The Git repository URL to sync to (e.g., `https://github.com/username/repo.git`)
24-
- `GITHUB_USERNAME`: Your GitHub username
25-
- `GITHUB_EMAIL`: Your GitHub email address
22+
- `GL_USERNAME`: Your GitLab username
23+
- `GH_REPOSITORY`: The Git repository URL to sync to (e.g., `https://github.com/username/repo.git`)
24+
- `GH_USERNAME`: Your GitHub username
25+
- `GH_EMAIL`: Your GitHub email address
2626

2727
## Manual Usage
2828

2929
You can also run the script manually:
3030

3131
```bash
32-
export GITLAB_USERNAME="your-gitlab-username"
33-
export REPOSITORY="https://github.com/username/repo.git"
34-
export GITHUB_USERNAME="your-github-username"
35-
export GITHUB_EMAIL="[email protected]"
32+
export GL_USERNAME="your-gitlab-username"
33+
export GH_REPOSITORY="https://github.com/username/repo.git"
34+
export GH_USERNAME="your-github-username"
35+
export GH_EMAIL="[email protected]"
3636

3737
./script.sh
3838
```

script.sh

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
11
#!/usr/bin/env bash
22

3-
if [ -z "${GITLAB_USERNAME}" ]; then
4-
echo "USERNAME is not set"
3+
if [ -z "${GL_USERNAME}" ]; then
4+
echo "GL_USERNAME is not set"
55
exit 1
66
fi
7-
if [ -z "${REPOSITORY}" ]; then
8-
echo "REPOSITORY is not set"
7+
if [ -z "${GH_REPOSITORY}" ]; then
8+
echo "GH_REPOSITORY is not set"
99
exit 1
1010
fi
11-
if [ -z "${GITHUB_USERNAME}" ]; then
12-
echo "GITHUB_USERNAME is not set"
11+
if [ -z "${GH_USERNAME}" ]; then
12+
echo "GH_USERNAME is not set"
1313
exit 1
1414
fi
15-
if [ -z "${GITHUB_EMAIL}" ]; then
16-
echo "GITHUB_EMAIL is not set"
15+
if [ -z "${GH_EMAIL}" ]; then
16+
echo "GH_EMAIL is not set"
1717
exit 1
1818
fi
1919

2020
cd "$(mktemp -d)"
2121
dir_path="$(pwd)"
2222
trap "rm -rf ${dir_path}" EXIT
23-
git clone "${REPOSITORY}" "repo"
23+
git clone "${GH_REPOSITORY}" "repo"
2424
cd "repo"
2525

26-
git config user.name "${GITHUB_USERNAME}"
27-
git config user.email "${GITHUB_EMAIL}"
26+
git config user.name "${GH_USERNAME}"
27+
git config user.email "${GH_EMAIL}"
2828

2929
PRE_COMMIT_MSG='auto: '
3030

3131
function modif(){
3232
cat changes | grep -q "true" && echo "false" > changes || echo "true" > changes
3333
}
3434

35-
todo="$(curl -s "https://gitlab.com/users/${GITLAB_USERNAME}/calendar.json" | jq -rc '. | to_entries | .[] | "\(.key)-\(range(.value)+1)"')"
35+
todo="$(curl -s "https://gitlab.com/users/${GL_USERNAME}/calendar.json" | jq -rc '. | to_entries | .[] | "\(.key)-\(range(.value)+1)"')"
3636
already_done="$(git log --pretty='format:%s' | grep -E "^${PRE_COMMIT_MSG}" | sed "s/^${PRE_COMMIT_MSG}//")"
3737

3838
export IFS=$'\n'

0 commit comments

Comments
 (0)