Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 3 additions & 9 deletions .github/workflows/generate-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,10 @@ jobs:
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "head_sha=${{ github.sha }}" >> "$GITHUB_OUTPUT"
echo "base_ref=main" >> "$GITHUB_OUTPUT"
echo "pr_number=manual" >> "$GITHUB_OUTPUT"
echo "is_manual=true" >> "$GITHUB_OUTPUT"
else
echo "head_sha=${{ github.event.workflow_run.head_sha }}" >> "$GITHUB_OUTPUT"
echo "base_ref=${{ github.event.workflow_run.pull_requests[0].base.ref }}" >> "$GITHUB_OUTPUT"
echo "pr_number=${{ github.event.workflow_run.pull_requests[0].number }}" >> "$GITHUB_OUTPUT"
echo "is_manual=false" >> "$GITHUB_OUTPUT"
fi

# ── 2. Checkout ───────────────────────────────────────────────────────────
Expand All @@ -55,7 +51,7 @@ jobs:
with:
ref: ${{ steps.ctx.outputs.head_sha }}
fetch-depth: 0
token: ${{ secrets.GITHUB_TOKEN }}
token: ${{ secrets.GH_PAT }}

# ── 3. Python ─────────────────────────────────────────────────────────────
- name: Set up Python
Expand All @@ -67,7 +63,6 @@ jobs:
run: pip install anthropic

# ── 4. Escaneia craftd-core buscando arquivos sem cobertura ──────────────
# Se override_files for informado no dispatch, usa eles no lugar.
- name: Find uncovered Kotlin files in craftd-core
id: changed
run: |
Expand Down Expand Up @@ -153,15 +148,14 @@ jobs:
- name: Open Pull Request with generated tests
if: steps.check.outputs.has_tests == 'true'
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GH_TOKEN: ${{ secrets.GH_PAT }}
run: |
PR_NUMBER="${{ steps.ctx.outputs.pr_number }}"
BRANCH="${{ steps.commit.outputs.branch }}"
BASE_BRANCH="${{ steps.ctx.outputs.base_ref }}"
COVERED="${{ steps.check.outputs.covered_names }}"

gh pr create \
--base "$BASE_BRANCH" \
--base "main" \
--head "$BRANCH" \
--title "[Auto] Add unit tests for craftd-core" \
--body "$(cat <<EOF
Expand Down
Loading