Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider adding a programmatic API #344

Open
sidvishnoi opened this issue Jun 8, 2020 · 1 comment
Open

Consider adding a programmatic API #344

sidvishnoi opened this issue Jun 8, 2020 · 1 comment
Assignees
Labels
enhancement New feature or request proposal
Milestone

Comments

@sidvishnoi
Copy link

Is your feature request related to a problem? Please describe

In some organizations, workflows have a lot of common custom steps across repositories/workflows. To ease with this, people create custom actions that wrap some of the other common actions so users don't have to copy-paste and update them manually across all workflows. Custom actions require access to programmatic API.

Describe the solution you'd like

Consider publishing this action to npm so it can be used programmatically.

It'll require a little refactoring. I propose requiring Input as an argument to run in main.js:

export async function run(inps: Inputs) {...}

The inputs can be passed to run in index.js, exposing an API from main.js (It might make sense to swap these file names - imports will become simpler).

Also, all @actions/* packages and other dependencies should probably not be bundled in the package, so they can be reused by other actions without duplication (tree shaking, if you will).

Describe alternatives you've considered

  • Clone and build the project in custom action to use the utils and instead of run() - which sucks.
  • Change the content of get-inputs.ts on clone with custom logic.

Additional context

GitHub published their @actions/cache action so other actions could use it without users requiring adding uses: @actions/cache step.

Thank you for creating such wonderful project!

@peaceiris peaceiris added the enhancement New feature or request label Jun 9, 2020
@peaceiris
Copy link
Owner

peaceiris commented Jun 9, 2020

Thank you for suggesting this!

Yes. I was considering this in my mind. The previous works on JasonEtco/actions-toolkit and actions/toolkit will probably be a good reference for us.

In addition, I am also maintaining other actions like:

Shared functions and methods with those projects are also useful.

Also, all @actions/* packages and other dependencies should probably not be bundled in the package, so they can be reused by other actions without duplication (tree shaking, if you will).

I agree with this that is one of the important things for users.

GitHub published their @actions/cache action so other actions could use it without users requiring adding uses: @actions/cache step.

I was watching this process. It will be also helpful for our cases.


This week and next week are examination weeks for me. I will work on this and other issues from the next weekend.

#87 #103 #163 #164 #165 #242 #245 #273 #309 #324 and #300

@peaceiris peaceiris added this to the v4.0.0 milestone Jul 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request proposal
Projects
None yet
Development

No branches or pull requests

2 participants