Skip to content

[Hackathon] fix(ci): the ci init github workflow fails on every Dependabot PR (no Actions secrets), but only skips forks #508

Closed

Description

@nftkingiii

Verified against (commit SHA or released version)

commit 988c035 (main, v0.14.0), built and run on Ubuntu 22.04, Node 22.20

Discord Username / User ID

onlyonenftking

What does this improvement do?

The generated workflow already knows that PRs without secrets would make the check "permanently red", and it skips fork PRs for that reason (ci.ts#L287-L289):

    # Fork PRs run without repository secrets, so the API key would be empty and
    # this check permanently red. Skip forks (a maintainer's push still runs it).
    if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}

Dependabot PRs have the same problem but pass this condition, because Dependabot pushes its branches to the base repo, so head.repo.full_name == github.repository. GitHub's docs (Troubleshooting Dependabot on GitHub Actions) say that when a Dependabot event triggers a workflow, Actions secrets are not available and only Dependabot secrets are. The workflow passes api-key: ${{ secrets.TESTSPRITE_API_KEY }}, so on every Dependabot PR that value is empty and the job fails with an auth error.

Any repo with Dependabot version updates turned on then gets a red TestSprite check on every dependency PR. That's the same "permanently red" result the fork guard exists to prevent, and it teaches people to ignore the check.

Reproduction:

$ git init -q app && cd app
$ testsprite ci init github --project proj_1 >/dev/null
$ grep -n "if:" .github/workflows/testsprite.yml
24:    if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository }}

For a Dependabot PR in this repo, head.repo.full_name equals github.repository, so the job runs with an empty secrets.TESTSPRITE_API_KEY (per the GitHub doc above).

Related but separate: #460 (the action this workflow uses is archived). Whatever replaces it, the generated if: condition needs this case either way.

Details / implementation notes

Planned fix (I'll open the PR once this is accepted):

  • Extend the generated condition the way GitHub's doc recommends: … && github.actor != 'dependabot[bot]' for pull_request events. Pushes from maintainers and merges to the default branch still run.
  • Update the comment above it to name both cases (forks and Dependabot), and add one line pointing to the alternative: store TESTSPRITE_API_KEY as a Dependabot secret too, then delete the actor check.
  • Existing generated files are untouched. Users get the new condition when they re-run ci init github --force, which is the regeneration path the workflow header already documents.
  • Tests in src/commands/ci.spec.ts: a snapshot/assertion of the generated if: line, plus a test that the comment mentions Dependabot.

Confirmations

  • I have searched existing issues and this is not a duplicate.
  • I have provided my Discord identity above for reward coordination.

Activity

  1. fyZhang66 commented on Oct 20, 2026

    @fyZhang66
    Contributor

    Confirmed on v0.15.0, thanks @nftkingiii. The generated if: skips fork PRs, but Dependabot pushes its branches from inside the repository, so those PRs pass the check and run with empty secrets. Accepted, scope:

    • Add github.actor != 'dependabot[bot]' to the pull_request branch of the generated if: (shape B) with a one-line comment next to the fork rule; the deployment_status branch is unchanged.
    • Update the ci init snapshot and the "what the template fixes in place" sentence in DOCUMENTATION.md.
    • Tests (must fail before the fix): the snapshot test.

    No new dependency. Comment /assign to claim it.

  2. added
    accepted
    on Oct 20, 2026
  3. Smile-Catpy commented on Oct 21, 2026

    @Smile-Catpy
    Contributor

    /assign

  4. testsprite-hob commented on Oct 21, 2026

    @testsprite-hob

    Assigned to @Smile-Catpy. Thanks for taking this on. (0 more slots available.)

    Your open assigned issues (3/3):

  5. added
    in-progress
    on Oct 21, 2026
  6. added
    hackathon
    on Oct 29, 2026
  7. added a commit that references this issue on Nov 9, 2026
    e67235a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

acceptedhackathonin-progress

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions