From c2f0b9de48a30dfa70a994252bf2eb8c8172795e Mon Sep 17 00:00:00 2001 From: sangge-rockpi <2251250136@qq.com> Date: Thu, 18 Jan 2024 22:29:09 +0800 Subject: [PATCH 1/5] use pyproject.toml to control deps --- containerfile | 4 ++-- dockerfile | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/containerfile b/containerfile index d2c2d06..1e12d5c 100644 --- a/containerfile +++ b/containerfile @@ -39,10 +39,10 @@ ENV PATH="${PATH}:/root/.local/bin" \ PIP_DEFAULT_TIMEOUT=100 # copy project files -COPY --chown=root:root requirements.txt main.py /app/ -i https://pypi.tuna.tsinghua.edu.cn/simple +COPY --chown=root:root pyproject.toml main.py /app/ # install dependencies -RUN python -m pip install /app/ +RUN python -m pip install /app/ -i https://pypi.tuna.tsinghua.edu.cn/simple # copy tests COPY --chown=root:root tests /app/tests/ diff --git a/dockerfile b/dockerfile index 75a6f05..eec5a24 100644 --- a/dockerfile +++ b/dockerfile @@ -39,10 +39,10 @@ ENV PATH="${PATH}:/root/.local/bin" \ PIP_DEFAULT_TIMEOUT=100 # copy project files -COPY --chown=root:root requirements.txt main.py /app/ +COPY --chown=root:root pyproject.toml main.py /app/ # install dependencies -RUN python -m pip install -r /app/requirements.txt -i https://pypi.tuna.tsinghua.edu.cn/simple +RUN python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple # execute program CMD python /app/main.py From 99b6b3f8873a9c1192f5da58a8fee77785a17a62 Mon Sep 17 00:00:00 2001 From: sangge-rockpi <2251250136@qq.com> Date: Thu, 18 Jan 2024 22:35:01 +0800 Subject: [PATCH 2/5] remove dev file --- test_giteaapi.py | 12 ------------ 1 file changed, 12 deletions(-) delete mode 100644 test_giteaapi.py diff --git a/test_giteaapi.py b/test_giteaapi.py deleted file mode 100644 index e0ed4eb..0000000 --- a/test_giteaapi.py +++ /dev/null @@ -1,12 +0,0 @@ -from gitea import * -URL = "https://git.mamahaha.work" -TOKEN = open("token.log", "r").read().strip() -gitea_connect = Gitea(URL, TOKEN) -print("Gitea Version: " + gitea_connect.get_version()) -print("API-Token belongs to user: " + gitea_connect.get_user().username) - -#repository = "sangge/tpre-python" -#target_branch = "main" -#gitea_repo = gitea_connect.get_repo(str(repository)) -#gitea_branch = gitea_repo.get_branch(target_branch) -#print(gitea_branch) \ No newline at end of file From 7a6d95d4369c97b8ea72741735b7a5dcdf282fa7 Mon Sep 17 00:00:00 2001 From: sangge-rockpi <2251250136@qq.com> Date: Thu, 18 Jan 2024 22:42:21 +0800 Subject: [PATCH 3/5] remove requirements.txt --- requirements.txt | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 requirements.txt diff --git a/requirements.txt b/requirements.txt deleted file mode 100644 index c69a39a..0000000 --- a/requirements.txt +++ /dev/null @@ -1,3 +0,0 @@ -faker>=21.0.0 -requests>=2.31.0 -py-gitea>=0.2.6 From 632b13121dd52400c422b0a104fa07605cd4124f Mon Sep 17 00:00:00 2001 From: sangge-rockpi <2251250136@qq.com> Date: Thu, 18 Jan 2024 22:59:49 +0800 Subject: [PATCH 4/5] update some readme --- README.md | 59 +++++++++---------------------------------------------- 1 file changed, 9 insertions(+), 50 deletions(-) diff --git a/README.md b/README.md index c8166ac..cbc1801 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,10 @@ -

- waka-readme -

+# Dev Metrics in Readme -# Dev Metrics in Readme [![Unit Tests](https://github.com/athul/waka-readme/actions/workflows/testing.yml/badge.svg?branch=master)](https://github.com/athul/waka-readme/actions/workflows/testing.yml) +fork from [waka-readme](https://github/athul/waka-readme) +edit for Gitea use. [WakaTime](https://wakatime.com) coding metrics on your profile readme. - - - - new_secrets_actions - - - -:speech_balloon: **Forum** | [GitHub discussions][gh_discuss] - ## New to WakaTime? > Nope? Skip to [#Prep work](#prep-work). @@ -39,7 +22,7 @@ Alternatively, you can fetch data from WakaTime compatible services such as [Wak ## Prep Work -A GitHub repository and a `README.md` file is required. We'll be making use of readme in the [profile repository][profile_readme]. +A Gitea repository and a `README.md` file is required. We'll be making use of readme in the [profile repository][profile_readme]. - Save the `README.md` file after copy-pasting the following special comments. Your dev-metics will show up in between. @@ -51,31 +34,9 @@ A GitHub repository and a `README.md` file is required. We'll be making use of r `` and `` are placeholders and must be retained as is. Whereas "`waka`" can be replaced by any alphanumeric string. See [#Tweaks](#tweaks) section for more. - Navigate to your repo's `Settings`: - - Go to `Secrets` (at `https://github.com/USERNAME/USERNAME/settings/secrets/actions/new` by replacing the `USERNAME` with your own username) and add a new secret "_Named_" `WAKATIME_API_KEY` with your API key as it's "_Secret_". + - Go to `Secrets` (at `https://your_gitea_url/username/.profile/settings/actions/secrets` by replacing the `USERNAME` with your own username) and add a new secret "_Named_" `WAKATIME_API_KEY` with your API key as it's "_Secret_". - - - - new_secrets_actions - - - - > If you're not using [profile repository][profile_readme], add another secret "_Named_" `GH_TOKEN` and in place of "_Secret_" insert your [GitHub token][gh_access_token]. - - - Go to `Workflow permissions` under `Actions` (at `https://github.com/USERNAME/USERNAME/settings/actions` by replacing the `USERNAME` with your own username) and set `Read and write permissions`. - - - - - new_secrets_actions - - - -- Create a new workflow file named `waka-readme.yml` inside `.github/workflows/` folder of your repository. + - Create a new workflow file named `waka-readme.yml` inside `.gitea/workflows/` folder of your profile repository. - Clear all existing contents, add following lines and save the file. ```yml @@ -93,7 +54,7 @@ A GitHub repository and a `README.md` file is required. We'll be making use of r name: WakaReadme DevMetrics runs-on: ubuntu-latest steps: - - uses: athul/waka-readme@master # this action name + - uses: https://git.mamahaha.work/sangge/waka-readme@master # this action name with: WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }} ``` @@ -161,13 +122,13 @@ jobs: runs-on: ubuntu-latest steps: # this action name - - uses: athul/waka-readme@master # do NOT replace with anything else + - uses: https://git.mamahaha.work/sangge/waka-readme@master # do NOT replace with anything else with: GH_TOKEN: ${{ secrets.GH_TOKEN }} # optional if on profile readme WAKATIME_API_KEY: ${{ secrets.WAKATIME_API_KEY }} # required ### meta API_BASE_URL: https://wakatime.com/api # optional - REPOSITORY: YOUR_GITHUB_USERNAME/YOUR_REPOSITORY_NAME # optional + REPOSITORY: YOUR_GITEA_USERNAME/YOUR_REPOSITORY_NAME # optional ### content SHOW_TITLE: true # optional SECTION_NAME: waka # optional @@ -228,5 +189,3 @@ I am a fan of minimal designs and the profile readme is a great way to show off [waka_plugins]: https://wakatime.com/plugins [waka_help]: https://wakatime.com/help/editors [profile_readme]: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-github-profile/customizing-your-profile/managing-your-profile-readme -[gh_access_token]: https://docs.github.com/en/actions/configuring-and-managing-workflows/authenticating-with-the-github_token -[gh_discuss]: https://github.com/athul/waka-readme/discussions From ad3a3b38e6b5e4784817da5f4a5abf3d25e852d2 Mon Sep 17 00:00:00 2001 From: sangge-rockpi <2251250136@qq.com> Date: Sat, 20 Jan 2024 00:43:13 +0800 Subject: [PATCH 5/5] update dockerfile --- dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dockerfile b/dockerfile index eec5a24..00032a7 100644 --- a/dockerfile +++ b/dockerfile @@ -42,7 +42,7 @@ ENV PATH="${PATH}:/root/.local/bin" \ COPY --chown=root:root pyproject.toml main.py /app/ # install dependencies -RUN python -m pip install -i https://pypi.tuna.tsinghua.edu.cn/simple +RUN python -m pip install /app/ -i https://pypi.tuna.tsinghua.edu.cn/simple # execute program CMD python /app/main.py