46b24d409909cdc00ac441448c0aa31cc35d12c9

Author
Carlo Sala <carlosalag@protonmail.com>
Committer
Carlo Sala <carlosalag@protonmail.com>
Date

Message

ci(dependencies): fix some envs and add requirements

Diff

 1diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml
 2index aab7401264c76eecba3ccd8e180b2c4678ef74f5..2e2217e1c0dd3b25a39e9c9143133fe78a90b94d 100644
 3--- a/.github/workflows/dependencies.yml
 4+++ b/.github/workflows/dependencies.yml
 5@@ -8,19 +8,22 @@ jobs:
 6   check:
 7     name: Check for updates
 8     runs-on: ubuntu-latest
 9+    if: github.repository == 'ohmyzsh/ohmyzsh'
10     steps:
11       - name: Checkout
12-        if: github.repository == 'ohmyzsh/ohmyzsh'
13         uses: actions/checkout@v4
14       - name: Authenticate as @ohmyzsh
15+        id: generate_token
16         uses: ohmyzsh/github-app-token@v2
17         with:
18           app_id: ${{ secrets.OHMYZSH_APP_ID }}
19           private_key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }}
20       - name: Process dependencies
21         env:
22-          GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
23-          TMP_DIR: ${{ env.RUNNER_TEMP }}
24+          GH_TOKEN: ${{ steps.generate_token.outputs.token }}
25+          GIT_APP_NAME: ohmyzsh[bot]
26+          GIT_APP_EMAIL: 54982679+ohmyzsh[bot]@users.noreply.github.com
27+          TMP_DIR: ${{ runner.temp }}
28         run: |
29-          gh auth login --with-token <<< "${GITHUB_TOKEN}"
30+          pip install -r .github/workflows/dependencies/requirements.txt
31           python3 .github/workflows/dependencies/updater.py
32diff --git a/.github/workflows/dependencies/requirements.txt b/.github/workflows/dependencies/requirements.txt
33new file mode 100644
34index 0000000000000000000000000000000000000000..3c4c149ea17b864c8e3db81dd0fadcd1bf33eef7
35--- /dev/null
36+++ b/.github/workflows/dependencies/requirements.txt
37@@ -0,0 +1,2 @@
38+PyYAML~=6.0.1
39+requests~=2.31.0
40diff --git a/.github/workflows/dependencies/updater.py b/.github/workflows/dependencies/updater.py
41index 5af19d14c5308f28f8865e9e0866d39cde24354b..f54d316f938383dc4d15bd146d0df06eed1bdb58 100644
42--- a/.github/workflows/dependencies/updater.py
43+++ b/.github/workflows/dependencies/updater.py
44@@ -302,8 +302,8 @@ class Git:
45 
46   @staticmethod
47   def add_and_commit(scope: str, version: str):
48-    user_name = "ohmyzsh"
49-    user_email = "bot@ohmyz.sh"
50+    user_name = os.environ.get("GIT_APP_NAME")
51+    user_email = os.environ.get("GIT_APP_EMAIL")
52 
53     # Add all files to git staging
54     CommandRunner.run_or_fail(["git", "add", "-A", "-v"], stage="AddFiles")