--- # Heavily inspired by https://github.com/infinilabs/gitea-pr name: "Create Gitea PR Comment" description: Add a comment to a PR in Gitea. inputs: url: description: URL to the Gitea instance required: true token: description: Personal access token to the Gitea instance required: true path: description: > Relative path under $GITHUB_WORKSPACE to the repository. Defaults to $GITHUB_WORKSPACE. pr: description: "Index of the PR to comment on" required: true message: description: 'The comment message to add' required: true tea-version: description: Tea CLI version required: true default: 0.11.1 branding: icon: git-pull-request color: green runs: using: composite steps: - name: Check the OS of the runner if: ${{ runner.os != 'Linux' }} shell: bash run: | echo "::error title=⛔ error hint::Support Linux Only" exit 1 - name: Get the commit message id: commit shell: bash run: | cd "${{ inputs.path || env.GITHUB_WORKSPACE }}" && echo "$PWD" { echo "COMMIT_MSG<> "$GITHUB_OUTPUT" { echo "COMMIT_DESC<> "$GITHUB_OUTPUT" cat $GITHUB_OUTPUT - name: Install Tea env: TEA_DL_ARCH: '${{ fromJson(''{ "x86": "386", "x64": "amd64", "ARM": "arm", "ARM64": "arm64" }'')[ runner.arch ] }}' TEA_DL_URL: "https://dl.gitea.com/tea/${{ inputs.tea-version }}\ /tea-${{ inputs.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-${{ inputs.tea-version }}-linux-${TEA_DL_ARCH}.sha256"); then sudo mv "tea-${{ inputs.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${{ inputs.tea-version }} Checksum Failed" exit 1 fi else echo "Tea CLI already installed" fi - name: Login to Gitea shell: bash env: GIT_SERVER_URL: ${{ inputs.url }} GIT_SERVER_TOKEN: ${{ inputs.token }} run: >- cd "${{ inputs.path || env.GITHUB_WORKSPACE }}" && echo "$PWD" && tea login add -u "$GIT_SERVER_URL" -t "$GIT_SERVER_TOKEN" - name: Create pull request comment shell: bash run: >- cd "${{ inputs.path || env.GITHUB_WORKSPACE }}" && echo "$PWD" && tea comment "${{ inputs.pr }}" "${{ inputs.message }}"