Skip to content

Regen API Docs action overwrites tidev URLs with appcelerator fallback #258

@macCesar

Description

@macCesar

Summary

The "Regen API Docs" GitHub Action replaces all github.com/tidev/ URLs in docs/api/ with github.com/appcelerator/ every time it runs. This reverts manual fixes (like those in commits 689b2911b8 and a2f553a85d by Hans) and affects 3,141 occurrences across 119 files.

Root Cause

The issue is in titanium-docgen (package inside tidev/docs-devkit):

File: packages/titanium-docgen/generators/json-raw_generator.js, lines 247-254

const stdout = exec('git config --get remote.origin.url', { cwd: filepath }).toString().trim();
const m = stdout.match(/^(git@|https:\/\/)github.com[:/]([\w-]+)\/([\w_\-.]+)\.git$/);
if (!m) {
    console.log(`Unable to pull github org/repo from url: ${stdout}`);
    const result = 'https://github.com/appcelerator/titanium_mobile/edit/master/';
    //             ^^^^^^^^^^^^^^^^^^^ hardcoded fallback to appcelerator
    REPO_URLS.set(filepath, result);
    return result;
}

Two problems:

  1. The regex requires .git at the end of the remote URL, but actions/checkout@v3 sets the remote as https://github.com/tidev/titanium_mobile (no .git suffix) — so the regex never matches.

  2. The fallback is hardcoded to appcelerator — so when the regex fails, every editUrl gets appcelerator/titanium_mobile instead of tidev/titanium_mobile.

How the pipeline works

1. Workflow runs "npm run clean:api"  →  deletes all docs/api/ files
2. Workflow runs "npm run docs:metadata" → titanium-docgen generates api.json
   → getRepoUrl() fails regex → falls back to appcelerator URLs
3. Workflow runs "npm run docs:migrate"  → generates ~580 .md files from api.json
   → each .md gets: editUrl: https://github.com/appcelerator/...
4. git auto-commit "Apply automatic changes"
   → overwrites any previous manual URL fixes

Evidence

  • Hans's manual fixes (2026-01-13): 689b2911b8, a2f553a85d — correctly changed URLs to tidev
  • Bot reverted them (2026-03-15): d1fdb129ad — "Apply automatic changes" by github-actions[bot]
  • Still broken today: 3,141 occurrences of github.com/appcelerator/ across 119 files in docs/api/

Suggested Fix

In tidev/docs-devkit, file packages/titanium-docgen/generators/json-raw_generator.js:

// Make .git optional in the regex:
const m = stdout.match(/^(git@|https:\/\/)github.com[:/]([\w-]+)\/([\w_\-.]+?)(?:\.git)?$/);
if (!m) {
    console.log(`Unable to pull github org/repo from url: ${stdout}`);
    // Update fallback to tidev:
    const result = 'https://github.com/tidev/titanium_mobile/edit/master/';
    REPO_URLS.set(filepath, result);
    return result;
}

Also consider changing edit/master/ to edit/main/ since most repos now use main as the default branch.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions