1

Is there a way to specify custom github actions for a typescript project in a .projenrc.js file? I've tried reading this documentation: https://github.com/projen/projen-github-action-typescript/blob/main/API.md but I couldn't find clear instructions on how to include my custom actions in the TypeScriptProject's configuration options.

PS: I wanted to add the projen tag, but I don't have enough reputation to add.

2
  • Just to clarify, you have a custom GitHub Action written in TypeScript that you want to use. Is that correct? Commented Jan 27, 2023 at 21:36
  • No, it's a TypeScriptProject from the projen library and I want to add an action to one of the existing workflows. Commented Jan 31, 2023 at 9:39

1 Answer 1

1

I was able to add a custom github action in the .projenrc.js file in the following way:

// .projenrc.js

const { typescript } = require('projen');

const project = new typescript.TypeScriptProject({
    ...config
});

const workflow = project.github.workflows.find((wf) => wf.name === 'release');

if (!!workflow) {
    workflow.addJob('job_name', { ...jobConfig }); // for job config: https://github.com/projen/projen/blob/65b4194c163f47ba4842981b0c92dbe516be787b/src/github/workflows-model.ts#L6
}
project.synth();
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.