最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Combine composite actions from the same repo in GitHub Actions - Stack Overflow

programmeradmin1浏览0评论

This is my simplified GitHub Actions workflow structure. I have application repository (app_repo) which has build_and_deploy workflow. This workflow is using reusable workflow from the action_repo, which is actually meant to be implemented by using composite actions. Something like:

app_repo.build_and_deploy
* action_repo.deploy_and_deploy (workflow)

action_repo
* build_and_deploy (reusable workflow)
    - .github/actions/build (action)
    - .github/actions/deploy (action)

The problem here is that .github/actions path is relative within action_repo and when I call build_and_deploy workflow from app_repo then this relative path is not working.

How can I build modular workflow in action_repo and use composite actions that reside in the same repo?

This is my simplified GitHub Actions workflow structure. I have application repository (app_repo) which has build_and_deploy workflow. This workflow is using reusable workflow from the action_repo, which is actually meant to be implemented by using composite actions. Something like:

app_repo.build_and_deploy
* action_repo.deploy_and_deploy (workflow)

action_repo
* build_and_deploy (reusable workflow)
    - .github/actions/build (action)
    - .github/actions/deploy (action)

The problem here is that .github/actions path is relative within action_repo and when I call build_and_deploy workflow from app_repo then this relative path is not working.

How can I build modular workflow in action_repo and use composite actions that reside in the same repo?

Share Improve this question edited Feb 14 at 14:37 jonrsharpe 122k30 gold badges267 silver badges474 bronze badges asked Feb 14 at 14:35 Dmitrij KultasevDmitrij Kultasev 5,7578 gold badges52 silver badges103 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 1

IIUC you can specify the composite action you want to use in your reusable workflow with a fully qualified path to the action, namely:

<anization>/<repository>/.github/actions/deploy@main

instead of

.github/actions/deploy

An example could be GitHub's cache/restore which is used as follows:

steps:
  - uses: actions/cache/restore@v4

(instead of @main you may want to use a release tag or commit's sha, pinned dependencies are usually the best idea).

Please note your repo needs to have access to the private composite action, see here for example.

发布评论

评论列表(0)

  1. 暂无评论