diff --git a/.github/workflows/dependencies.yml b/.github/workflows/dependencies.yml index aab740126..2e2217e1c 100644 --- a/.github/workflows/dependencies.yml +++ b/.github/workflows/dependencies.yml @@ -8,19 +8,22 @@ jobs: check: name: Check for updates runs-on: ubuntu-latest + if: github.repository == 'ohmyzsh/ohmyzsh' steps: - name: Checkout - if: github.repository == 'ohmyzsh/ohmyzsh' uses: actions/checkout@v4 - name: Authenticate as @ohmyzsh + id: generate_token uses: ohmyzsh/github-app-token@v2 with: app_id: ${{ secrets.OHMYZSH_APP_ID }} private_key: ${{ secrets.OHMYZSH_APP_PRIVATE_KEY }} - name: Process dependencies env: - GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }} - TMP_DIR: ${{ env.RUNNER_TEMP }} + GH_TOKEN: ${{ steps.generate_token.outputs.token }} + GIT_APP_NAME: ohmyzsh[bot] + GIT_APP_EMAIL: 54982679+ohmyzsh[bot]@users.noreply.github.com + TMP_DIR: ${{ runner.temp }} run: | - gh auth login --with-token <<< "${GITHUB_TOKEN}" + pip install -r .github/workflows/dependencies/requirements.txt python3 .github/workflows/dependencies/updater.py diff --git a/.github/workflows/dependencies/requirements.txt b/.github/workflows/dependencies/requirements.txt new file mode 100644 index 000000000..3c4c149ea --- /dev/null +++ b/.github/workflows/dependencies/requirements.txt @@ -0,0 +1,2 @@ +PyYAML~=6.0.1 +requests~=2.31.0 diff --git a/.github/workflows/dependencies/updater.py b/.github/workflows/dependencies/updater.py index 5af19d14c..f54d316f9 100644 --- a/.github/workflows/dependencies/updater.py +++ b/.github/workflows/dependencies/updater.py @@ -302,8 +302,8 @@ class Git: @staticmethod def add_and_commit(scope: str, version: str): - user_name = "ohmyzsh" - user_email = "bot@ohmyz.sh" + user_name = os.environ.get("GIT_APP_NAME") + user_email = os.environ.get("GIT_APP_EMAIL") # Add all files to git staging CommandRunner.run_or_fail(["git", "add", "-A", "-v"], stage="AddFiles")