Can i use action as a full job to encapsulate all CI process?

What i want to reach is encapsulate all CI process in one action.
I transform every step into JS action. There is no problem.
How can i use these JS actions in my action that combines them together?

What can i do now

name: Index

on: [push]

    runs-on: ubuntu-latest
      image: node:lts-alpine

      - uses: owner/install@master
      - uses: owner/test@master
      - uses: owner/build@master
      - uses: owner/deploy@master

But how turn it into something like this?

name: Index

on: [push]

uses: service-pipeline@master

The main reason is reduce duplicated code that needs to be maintained.

For example, Jenkins has shared libraries that allows to do such thing.

Does GitHub Actions support such type of encapsulation?



Your request is quite similar with job/step templates, just like the Templates feature for YAML pipelines on Azure Pipelines.
I tested and tried, unfortunately, GitHub Actions seems does not support job/step templates. And it also is very hard to encapsulate multiple jobs/steps into one action.
Looks like, currently we have no available methods to encapsulate multiple jobs/steps into one action, or setup job/step templates.


Would you know if such a feature is planned? This thread indicates there is an open feedback issue for this:

If we cannot service many projects with the same pipeline logic like we can with Jenkins shared libraries, it is impossible to switch to GitHub Actions without creating a large maintenance burden on the pipelines themselves. Some provision for keeping the configurations in the project repositories as small as possible is needed for that.

1 Like