Replies: 2 comments
-
here's my solution using - name: Checkout actions
uses: actions/checkout@v3
with:
sparse-checkout: |
.github/actions
path: actions
- uses: ./actions/.github/actions/setup_base
id: setup_base
with:
# optional
DEBUG_ENABLED: ${{ inputs.DEBUG_ENABLED }}
DEBUG_OS: ${{ inputs.DEBUG_OS }}
DEBUG_ARCH: ${{ inputs.DEBUG_ARCH }}
DEBUG_DETACHED: ${{ inputs.DEBUG_DETACHED }}
# required
MATRIX_OS: ${{ matrix.OS }}
MATRIX_ARCH: ${{ matrix.ARCH }}
- name: Checkout to workspace
shell: bash
run: |
if [ -d ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} ]; then
rm -rf ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}/*
rm -rf ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}/*.*
fi
git clone -b ${{ github.head_ref || github.ref_name }} https://github.com/${{ github.repository }}.git ${{ steps.setup_base.outputs.WORKSPACE_ROOT }}
ls ${{ steps.setup_base.outputs.WORKSPACE_ROOT }} details here. |
Beta Was this translation helpful? Give feedback.
0 replies
-
There is another approach I found today, but it's not ideal. - uses: org/repo/.github/my-composite-action That expects the action to be on the - uses: org/repo/.github/my-composite-action@abc123 I didn't try, but I assume you can also use the As this is the kind of thing you probably don't change often, this might be an acceptable workaround for some users. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I really like the concept of composite actions, but there is a fundamental problem with composite actions and templates which are supposed to be used in the same repository. Let's look how it is currently done, to re-use composite actions, which are located in the very same repository.
So far so good, BUT:
In our CI / CD workflow, we check out the repository only once in the very first job. We do that, because the checkout takes some time, as our mono repository is quite large. From this initial checkout, we then pass relevant parts of our repository to the corresponding, following jobs as artifacts. And it works fine and makes our CI / CD architecture much faster. In fact, there are also tons of other use-cases for doing so.
But the issue with that, is that I basically can't use template actions from the repositories .github directory in all the following jobs anymore. The workaround would be, to also upload the .github directory as an artifact and to pass them to all following jobs as well, but I don't really like this approach, because it creates so much more boilerplate definitions/steps in the YAML file.
An additional for an "uses" option like it's the case with reusable workflows would really help to solve this problem:
It would be basically a sparse checkout, without doing all this overhead definitions to make them re-usable in every job. Just like I guess it's the case with reusable workflows.
In fact, my expectation was though, that the .github directory is always accessible from all jobs, even if there is no checkout of the source at all, as it's more of a meta definition for the pipeline and not part of the actual source code. I could see future problems regarding this as well for upcoming features, as this could always be a problem, which needs to be handled. As far as I know reusable workflows also didn't support this in the very beginning. At least some kind of option in jobs or whatever, where you can basically define to always have access to reusable workflows, even without any checkouts done beforehand, would help immensely here. Basically something like this:
Either this is already possible, and I am doing something wrong, or this is really something, which needs to be supported as well. Because having not ability of reusing workflows in reusable workflows makes it sadly not that mighty in comparison to composite actions, which are capable of doing so, as described in here.
I would love to find a better approach for handling templates by getting some kind of support for this!
Beta Was this translation helpful? Give feedback.
All reactions