diff --git a/.github/workflows/dependency-check.yml b/.github/workflows/dependency-check.yml index 27582b9..dfd018e 100644 --- a/.github/workflows/dependency-check.yml +++ b/.github/workflows/dependency-check.yml @@ -8,6 +8,7 @@ on: env: RUST_VERSION: "1.90" + TEA_VERSION: "0.9.2" jobs: check-dependencies: @@ -97,6 +98,8 @@ jobs: git diff Cargo.toml.liquid git checkout -b deps/auto-upgrade-${{ github.run_number }} git add Cargo.toml.liquid + git config user.email "bot@gitea.actions" + git config user.name "Dependency Bot" git commit -m "chore: upgrade dependencies" working-directory: ${{ github.workspace }} @@ -190,22 +193,55 @@ jobs: cat pr-body.txt working-directory: ${{ github.workspace }} + - name: Install Tea + if: steps.upgrade.outputs.has_updates == 'true' + env: + TEA_DL_ARCH: '${{ fromJson(''{ "x86": "386", "x64": "amd64", "ARM": "arm", "ARM64": "arm64" }'')[ runner.arch ] }}' + TEA_DL_URL: "https://dl.gitea.com/tea/${{ env.TEA_VERSION }}/tea-${{ env.TEA_VERSION }}-linux-" + shell: bash + run: | + if ! command -v tea >/dev/null 2>&1; then + TEA_DIR=$(mktemp -d -t tmp.XXXX) + pushd $TEA_DIR + wget -q -nc "${TEA_DL_URL}${TEA_DL_ARCH}" + wget -q -nc "${TEA_DL_URL}${TEA_DL_ARCH}.sha256" + if $(sha256sum --quiet -c "tea-${{ env.TEA_VERSION }}-linux-${TEA_DL_ARCH}.sha256"); then + sudo mv "tea-${{ env.TEA_VERSION }}-linux-${TEA_DL_ARCH}" /usr/bin/tea + sudo chmod +x /usr/bin/tea + sudo cp -rf /usr/bin/tea $RUNNER_TOOL_CACHE/bin + popd + rm -rf $TEA_DIR + else + popd + rm -rf $TEA_DIR + echo "::error title=⛔ error hint::Tea v${{ env.TEA_VERSION }} Checksum Failed" + exit 1 + fi + else + echo "Tea CLI already installed" + fi + + - name: Login to Gitea + if: steps.upgrade.outputs.has_updates == 'true' + shell: bash + run: >- + cd "${{ env.GITHUB_WORKSPACE }}" && + tea login add + -u "${{ github.server_url }}" + -t "${{ secrets.GITHUB_TOKEN }}" + - name: Create Pull Request with dependency updates if: steps.upgrade.outputs.has_updates == 'true' - uses: infinilabs/gitea-pr@v0 permissions: contents: write - with: - url: ${{ github.server_url }} - token: ${{ secrets.GITHUB_TOKEN }} - commit-message: "chore: upgrade dependencies" - committer: "Dependency Bot " - author: "Dependency Bot " - base: ${{ github.ref_name }} - branch: ${{ github.actor }}:deps/auto-upgrade-${{ github.run_number }} - title: "⬆️ Automated Dependency Upgrade" - body-path: ${{ github.workspace }}/pr-body.txt - pr-label: "deps/bot" + run: >- + cd "${{ env.GITHUB_WORKSPACE }}" && + tea pr create + --head "${{ github.actor }}:deps/auto-upgrade-${{ github.run_number }}" + --base "${{ github.ref_name }}" + --title "⬆️ Automated Dependency Upgrade" + --description "" + --labels "deps/bot" - name: Summary if: success()