References in GitHub workflows and composite actions
Enabling a GitHub composite action to call another action in the same repo.
This can be done with reusable workflows, but not yet composite actions: github.blog/changelog/2022-01-25-github-actions-reusable-workflows-can-be-referenced-locally
The problem¶
When running a composite action
(even in a reusable workflow), I want to be
able to use the same GitHub ref
for the actions that exist within the remote repo. For instance, I have
an actions monorepo and would like to have some of my composite actions
be able to call another action within the actions monorepo using the version (ref
) that the action is using.
For example, the check-semver-labels
action calls the label-checker
action:
- name: Check for semantic version labels
uses: rwaight/actions/github/label-checker@main # can use version specific or main
#uses: rwaight/actions/github/label-checker@v1
id: semver-labels-check
with:
prefix_mode: true
one_of: ${{ inputs.semver-prefix }}
#none_of: "skip-changelog"
allow_failure: ${{ inputs.allow-failure }}
repo_token: ${{ inputs.gh-token }}
References¶
- GitHub
actions/toolkit
- GitHub
actions/runner
- GitHub Community Discussions
Potential solutions¶
Here are some potential solutions:
- Get reusable workflow version action
canonical/get-workflow-version-action
GitHub composite action to get commit SHA that GitHub Actions reusable workflow was called with Workaround for
actions/toolkit#1264