Github Actions "templating"

Hi!
I’m looking for uncomplicate for CI pipelines for my repositories.
What do I mean by that:
We have a relatively complicated actions pipeline with like 12 steps and tons of code in a few steps, so the pipelines are big and hard to maintain on each repo.
I want to keep all of the steps in the single repo, and call it from my pipeline like so:

name: CI pipeline
on: [push]
jobs:
  ci_process:
      runs-on: ubuntu-latest
      steps:
          - uses: myaccount/ci_repo/lintering@master
          - uses: myaccount/ci_repo/terraform_init@master
               with:
                   tf_version: 0.14.1
          - uses: myaccount/ci_repo/terraform_plan@master
          - uses: myaccount/ci_repo/output_to_github@master

And in the ci_repo I would want to call for another actions\repos, like hashicorp/setup-terraform@v2
so, basically I would want to call for pipeline from another pipeline. Is there a way to do that?
So, the ci_repo terraform_init action would look like

name: terraform init
on: [push]
jobs:
  ci_process:
      runs-on: ubuntu-latest
      steps:
          - uses: hashicorp/terraform-setup@v2
            with:
                tf_version: ${{var.tf_version}}      

or something like that.
Big thanks in advance!

Hi @alexpotapov87, welcome to the GitHub Support Community! Actions supports composite run step actions. These actions let you combine multiple steps into a single reusable step.

However, there are some limitations to these, such as not being able to use the uses keyword inside them. As you’re wanting to combine multiple uses steps into a single block I’m not sure if this would be suitable for your situation. However, if these are custom actions you created then you could combine them into a composite run step.

Hey, @thomasshaped , thanks for the welcomes and quick reply!
The composite run step actions is super limited to bash only and unless there’s an easy way to run ready_to_use steps like hashicorp/setup-terraform@v1 and github/super-linter@v3 - it won’t be suitable for my case…
Thanks!

Yeah, I didn’t think it would be suitable for you, but thought I’d mention just in case :frowning_face: There’s been a lot of requests for a solution for exactly this issue so I’ll make sure to add this thread to our internal feature request for it too :v:

1 Like

You might also want to follow this issue discussing the future of composite run steps for updates on when these features do release!

1 Like