Open ghost opened 3 years ago
@tomschr in #44:
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.
We should look into this topic again and decide, if it can help to refactor our process workflow and deduplicate GHAs.
From the linked docs, #Limitations:
- Any environment variables set in an env context defined at the workflow level in the caller workflow are not propagated to the called workflow. For more information about the env context, see "Context and expression syntax for GitHub Actions."
- The strategy property is not supported in any job that calls a reusable workflow.
Not sure if I read this right but both of those limitations sound like they'd kill this for us:
gha-publish
job.strategy
property for parallelizing jobs.From the linked docs, #Limitations:
- Any environment variables set in an env context defined at the workflow level in the caller workflow are not propagated to the called workflow. For more information about the env context, see "Context and expression syntax for GitHub Actions."
- The strategy property is not supported in any job that calls a reusable workflow.
Not sure if I read this right but both of those limitations sound like they'd kill this for us:
* We need an environment variable for the `gha-publish` job. * We need the `strategy` property for parallelizing jobs.
The limitation on the strategy property isn't mentioned anymore.
Regarding the environment variables, I don't know. Perhaps it could be passed as an input. :shrug:
Currently, whenever the workflow needs to be updated in the content repos, we need to push the diff to a whole bunch of different repos (~10) and branches (~5 per repo).
So far, my tools of choice have been
git-format-patch
andgit-am
:git format-patch -1 SHA
cd repo
b='branch_name'; git checkout "$b" && git am /patch/to/0001-patch_file.patch && git push
Cons:
Pros:
Ideas: