Skip to content

Commit 0d465a8

Browse files
Merge pull request #91 from CodandoTV/chore/make-test-generation-manual
fix: restore workflow_run trigger + use GH_PAT for PR creation
2 parents 12b91f7 + 21047ac commit 0d465a8

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

.github/workflows/generate-tests.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,10 @@ jobs:
3939
run: |
4040
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
4141
echo "head_sha=${{ github.sha }}" >> "$GITHUB_OUTPUT"
42-
echo "base_ref=main" >> "$GITHUB_OUTPUT"
4342
echo "pr_number=manual" >> "$GITHUB_OUTPUT"
44-
echo "is_manual=true" >> "$GITHUB_OUTPUT"
4543
else
4644
echo "head_sha=${{ github.event.workflow_run.head_sha }}" >> "$GITHUB_OUTPUT"
47-
echo "base_ref=${{ github.event.workflow_run.pull_requests[0].base.ref }}" >> "$GITHUB_OUTPUT"
4845
echo "pr_number=${{ github.event.workflow_run.pull_requests[0].number }}" >> "$GITHUB_OUTPUT"
49-
echo "is_manual=false" >> "$GITHUB_OUTPUT"
5046
fi
5147
5248
# ── 2. Checkout ───────────────────────────────────────────────────────────
@@ -55,7 +51,7 @@ jobs:
5551
with:
5652
ref: ${{ steps.ctx.outputs.head_sha }}
5753
fetch-depth: 0
58-
token: ${{ secrets.GITHUB_TOKEN }}
54+
token: ${{ secrets.GH_PAT }}
5955

6056
# ── 3. Python ─────────────────────────────────────────────────────────────
6157
- name: Set up Python
@@ -67,7 +63,6 @@ jobs:
6763
run: pip install anthropic
6864

6965
# ── 4. Escaneia craftd-core buscando arquivos sem cobertura ──────────────
70-
# Se override_files for informado no dispatch, usa eles no lugar.
7166
- name: Find uncovered Kotlin files in craftd-core
7267
id: changed
7368
run: |
@@ -153,15 +148,14 @@ jobs:
153148
- name: Open Pull Request with generated tests
154149
if: steps.check.outputs.has_tests == 'true'
155150
env:
156-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151+
GH_TOKEN: ${{ secrets.GH_PAT }}
157152
run: |
158153
PR_NUMBER="${{ steps.ctx.outputs.pr_number }}"
159154
BRANCH="${{ steps.commit.outputs.branch }}"
160-
BASE_BRANCH="${{ steps.ctx.outputs.base_ref }}"
161155
COVERED="${{ steps.check.outputs.covered_names }}"
162156
163157
gh pr create \
164-
--base "$BASE_BRANCH" \
158+
--base "main" \
165159
--head "$BRANCH" \
166160
--title "[Auto] Add unit tests for craftd-core" \
167161
--body "$(cat <<EOF

0 commit comments

Comments
 (0)