A command line CI runs: evaluated from its directory with its variables; * $0 is unknown. */
| 3860 | /* A command line CI runs: evaluated from its directory with its variables; |
| 3861 | * $0 is unknown. */ |
| 3862 | static 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 | |
| 3887 | static void sh_ci_file(sh_pass_t *p, const char *rel, const char *src, size_t len) { |
| 3888 | CBMArena a; |
nothing calls this directly
no test coverage detected