openSUSE / doc-ci

Continuous integration for SUSE documentation
4 stars 6 forks source link

[Idea] Consider reuse of workflows #44

Closed tomschr closed 3 years ago

tomschr commented 3 years ago

Situation

We've tried to modularize our processes and did a decent share with GitHub Actions (GHA). When we've started with GHA, we weren't able to reuse workflows, only Actions.

Now it's possible to share GitHub workflows. The GitHub workflow contains these lines at the beginning:

on: 
  workflow_call:
    inputs:
      # defines the inputs of this workflow

jobs:
  # contains all the jobs and their steps to complete this workflow

To "call" this workflow in another workflow, use jobs.<job_id>.uses like this:

jobs:
  build:
    uses: openSUSE/doc-ci/.github/workflows/build.yml@main
    # pass inputs of the workflow with the "with" keyword

It's possible to use a different branch or SHA as we've done so for GHA already.

Be aware, reuse of workflows are currently in beta and subject to change.

Suggestion

We should look into this topic again and decide, if it can help to refactor our process workflow and deduplicate GHAs.

References

ghost commented 3 years ago

dupe of #38, copying your comment there.