fix: use actions/checkout with token auth and self-hosted runner

This commit is contained in:
Shaun Arman 2026-04-10 14:07:54 -05:00 committed by Shaun Arman
parent 0b85258e7d
commit f47dcf69a3

View File

@ -6,7 +6,7 @@ on:
jobs: jobs:
review: review:
runs-on: ubuntu-latest runs-on: self-hosted
container: container:
image: ubuntu:22.04 image: ubuntu:22.04
steps: steps:
@ -18,22 +18,21 @@ jobs:
jq \ jq \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
- name: Checkout code
uses: actions/checkout@v4
with:
token: ${{ secrets.TFT_GITEA_TOKEN }}
ref: ${{ github.head_ref }}
- name: Get PR diff - name: Get PR diff
env: id: diff
BASE_REF: ${{ github.base_ref }}
HEAD_REF: ${{ github.head_ref }}
run: | run: |
git config --global user.name "Automated Review" git fetch origin ${{ github.base_ref }}
git config --global user.email "review@example.com" git diff origin/${{ github.base_ref }}..HEAD > /tmp/pr_diff.txt
git clone https://gogs.tftsr.com/sarman/tftsr-devops_investigation.git /tmp/repo
cd /tmp/repo
git fetch origin
git checkout $HEAD_REF
git diff origin/$BASE_REF..HEAD > /tmp/pr_diff.txt
echo "diff_size=$(wc -l < /tmp/pr_diff.txt)" >> $GITHUB_OUTPUT echo "diff_size=$(wc -l < /tmp/pr_diff.txt)" >> $GITHUB_OUTPUT
- name: Analyze with Ollama - name: Analyze with Ollama
if: success() if: steps.diff.outputs.diff_size > '0'
env: env:
OLLAMA_URL: https://ollama-ui.tftsr.com/ollama/v1 OLLAMA_URL: https://ollama-ui.tftsr.com/ollama/v1
API_KEY: ${{ secrets.OLLAMA_API_KEY }} API_KEY: ${{ secrets.OLLAMA_API_KEY }}