Help
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Copilot Lvl 3
Message 1 of 3

the same dependency in all workflows / jobs

Solved! Go to Solution.

```yaml

    runs-onubuntu-18.04
    steps:
    - namecheckout
      usesactions/checkout@v1
      with:
        ref: [this will be different]
        fetch-depth1
        token${{ secrets.GITHUB_TOKEN }}
 
    - nameInstall java
      usesactions/setup-java@v1
      with:
        java-version'13.0.1'

    - nameInstall clojure
      usesDeLaGuardo/setup-clojure@2.0
      with:
        tools-deps'1.10.1.478'

    - runnpm i
```
 
1) I want to start each workflow file in the same way. Do I have to create github action from that part in the same repository? No other way?
 
2) I would like to prepare all dependencies in job and later run a few jobs based on the state of the system after finish job1. Is it possible?
 
1. run job 1
1.a. install java
2. run job 2, job 3, job 4 on system after finish job 1 (so with java installed)
 
Do I have to install the same java version for each job separately? And more dependencies.
2 Replies
Solution
GitHub Partner
Message 2 of 3

Re: the same dependency in all workflows / jobs

  • I want to start each workflow file in the same way. Do I have to create github action from that part in the same repository? No other way?

 

There is not an actions template conception now, if you want to run a group of same actions in different workflows, you need to add those actions in each workflow file now.

 

  • I would like to prepare all dependencies in job and later run a few jobs based on the state of the system after finish job1. Is it possible?

 

You can use jobs.<job_id>.needs . Identifies any jobs that must complete successfully before this job will run.

Example: 

job needs job.png

For more information, you can refer to https://help.github.com/cn/actions/automating-your-workflow-with-github-actions/workflow-syntax-for-...

 

  • Do I have to install the same java version for each job separately? And more dependencies.

 

Yes, as jobs are separated, each job runs on different machine, you need to install java for each job.

 

Copilot Lvl 3
Message 3 of 3

Re: the same dependency in all workflows / jobs

Not what I wanted to hear, but true :)

 

As workaround probably the best way is to create action in the same repository which preapre all dependencies for all workflows and jobs in the same way. Or just use 1 long job.