mirror of
https://github.com/jaedle/mirror-to-gitea.git
synced 2026-01-09 21:07:55 -05:00
Use dedicated parameter for single run
This commit is contained in:
25
README.md
25
README.md
@@ -34,18 +34,19 @@ private repos, they will be created as private repos on your gitea server.
|
|||||||
|
|
||||||
All configuration is performed through environment variables. Flags are considered `true` on `true`, `TRUE` or `1`.
|
All configuration is performed through environment variables. Flags are considered `true` on `true`, `TRUE` or `1`.
|
||||||
|
|
||||||
| Parameter | Required | Type | Default | Description |
|
| Parameter | Required | Type | Default | Description |
|
||||||
|-----------------------------|----------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-----------------------------|----------|--------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| GITHUB_USERNAME | yes | string | - | The name of the GitHub user or organisation to mirror. |
|
| GITHUB_USERNAME | yes | string | - | The name of the GitHub user or organisation to mirror. |
|
||||||
| GITEA_URL | yes | string | - | The url of your Gitea server. |
|
| GITEA_URL | yes | string | - | The url of your Gitea server. |
|
||||||
| GITEA_TOKEN | yes | string | - | The token for your gitea user (Settings -> Applications -> Generate New Token). **Attention: if this is set, the token will be transmitted to your specified Gitea instance!** |
|
| GITEA_TOKEN | yes | string | - | The token for your gitea user (Settings -> Applications -> Generate New Token). **Attention: if this is set, the token will be transmitted to your specified Gitea instance!** |
|
||||||
| GITHUB_TOKEN | no* | string | - | GitHub token (PAT). Is mandatory in combination with `MIRROR_PRIVATE_REPOSITORIES`. |
|
| GITHUB_TOKEN | no* | string | - | GitHub token (PAT). Is mandatory in combination with `MIRROR_PRIVATE_REPOSITORIES`. |
|
||||||
| MIRROR_PRIVATE_REPOSITORIES | no | bool | FALSE | If set to `true` your private GitHub Repositories will be mirrored to Gitea. Requires `GITHUB_TOKEN`. |
|
| MIRROR_PRIVATE_REPOSITORIES | no | bool | FALSE | If set to `true` your private GitHub Repositories will be mirrored to Gitea. Requires `GITHUB_TOKEN`. |
|
||||||
| SKIP_FORKS | no | bool | FALSE | If set to `true` will disable the mirroring of forks from your GitHub User / Organisation. |
|
| SKIP_FORKS | no | bool | FALSE | If set to `true` will disable the mirroring of forks from your GitHub User / Organisation. |
|
||||||
| DELAY | no | int | 3600 | Number of seconds between program executions. Setting this will only affect how soon after a new repo was created a mirror may appar on Gitea, but has no affect on the ongoing replication. If set to `0` the task is only executed once. |
|
| DELAY | no | int | 3600 | Number of seconds between program executions. Setting this will only affect how soon after a new repo was created a mirror may appar on Gitea, but has no affect on the ongoing replication. |
|
||||||
| DRY_RUN | no | bool | FALSE | If set to `true` will perform no writing changes to your Gitea instance, but log the planned actions. |
|
| DRY_RUN | no | bool | FALSE | If set to `true` will perform no writing changes to your Gitea instance, but log the planned actions. |
|
||||||
| INCLUDE | no | string | "*" | Name based repository filter (include): If any filter matches, the repository will be mirrored. It supports glob format, multiple filters can be separated with commas (`,`) |
|
| INCLUDE | no | string | "*" | Name based repository filter (include): If any filter matches, the repository will be mirrored. It supports glob format, multiple filters can be separated with commas (`,`) |
|
||||||
| EXCLUDE | no | string | "" | Name based repository filter (exclude). If any filter matches, the repository will not be mirrored. It supports glob format, multiple filters can be separated with commas (`,`). `EXCLUDE` filters are applied after `INCLUDE` ones. |
|
| EXCLUDE | no | string | "" | Name based repository filter (exclude). If any filter matches, the repository will not be mirrored. It supports glob format, multiple filters can be separated with commas (`,`). `EXCLUDE` filters are applied after `INCLUDE` ones.
|
||||||
|
| SINGLE_RUN | no | bool | FALSE | If set to `TRUE` the task is only executed once. |
|
||||||
|
|
||||||
### Docker
|
### Docker
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,9 @@ do
|
|||||||
echo "Starting to create mirrors..."
|
echo "Starting to create mirrors..."
|
||||||
node /app/dist/index.js
|
node /app/dist/index.js
|
||||||
|
|
||||||
if [ $DELAY -eq 0 ]; then break; fi
|
case $SINGLE_RUN in
|
||||||
|
(TRUE | true | 1) break;;
|
||||||
|
esac
|
||||||
|
|
||||||
echo "Waiting for ${DELAY} seconds..."
|
echo "Waiting for ${DELAY} seconds..."
|
||||||
sleep "${DELAY}"
|
sleep "${DELAY}"
|
||||||
|
|||||||
@@ -44,6 +44,7 @@ export function configuration() {
|
|||||||
delay: readInt("DELAY") ?? defaultDelay,
|
delay: readInt("DELAY") ?? defaultDelay,
|
||||||
include: (readEnv("INCLUDE") ?? defaultInclude).split(",").map(f => f.trim()),
|
include: (readEnv("INCLUDE") ?? defaultInclude).split(",").map(f => f.trim()),
|
||||||
exclude: (readEnv("EXCLUDE") ?? defaultExclude).split(",").map(f => f.trim()),
|
exclude: (readEnv("EXCLUDE") ?? defaultExclude).split(",").map(f => f.trim()),
|
||||||
|
singleRun: readBoolean("SINGLE_RUN"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (config.github.privateRepositories && config.github.token === undefined) {
|
if (config.github.privateRepositories && config.github.token === undefined) {
|
||||||
|
|||||||
Reference in New Issue
Block a user