MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / sh_ci_cmd

Function sh_ci_cmd

src/pipeline/pass_shell.c:3862–3885  ·  view source on GitHub ↗

A command line CI runs: evaluated from its directory with its variables; * $0 is unknown. */

Source from the content-addressed store, hash-verified

3860/* A command line CI runs: evaluated from its directory with its variables;
3861 * $0 is unknown. */
3862static void sh_ci_cmd(const cbm_ci_cmd_t *cmd, void *ud) {
3863 sh_ci_t *x = ud;
3864 sh_t s;
3865 sh_state_init(&s, x->p, x->a, x->rel);
3866 if (s.env) {
3867 s.line_base = cmd->row;
3868 s.ci = cmd->ci;
3869 s.job = cmd->job;
3870 s.exec = cmd->exec;
3871 const char *wd = cmd->wd ? sh_join(x->a, "", cmd->wd) : NULL;
3872 s.cwd = wd ? (sh_cwd_t){SH_AT, wd} : (sh_cwd_t){SH_LOST, NULL};
3873 if (strcmp(cmd->ci, "github-actions") == 0) {
3874 sh_ci_var(&s, "GITHUB_WORKSPACE", SH_ROOT);
3875 if (cmd->action_dir) {
3876 sh_ci_var(&s, "GITHUB_ACTION_PATH", sh_anchor(x->a, cmd->action_dir));
3877 }
3878 }
3879 for (int i = 0; i < cmd->nenv; i++) {
3880 sh_ci_var(&s, cmd->env[PAIR_LEN * i], cmd->env[PAIR_LEN * i + SKIP_ONE]);
3881 }
3882 sh_run(&s, x->p->parser, cmd->text, cmd->len);
3883 }
3884 sh_state_free(&s);
3885}
3886
3887static void sh_ci_file(sh_pass_t *p, const char *rel, const char *src, size_t len) {
3888 CBMArena a;

Callers

nothing calls this directly

Calls 6

sh_state_initFunction · 0.85
sh_joinFunction · 0.85
sh_ci_varFunction · 0.85
sh_anchorFunction · 0.85
sh_runFunction · 0.85
sh_state_freeFunction · 0.85

Tested by

no test coverage detected