|
6 | 6 | - cron: '0 1 * * *' |
7 | 7 |
|
8 | 8 | jobs: |
9 | | - trigger_workflows: |
| 9 | + litecoin_updater: |
10 | 10 | runs-on: ubuntu-latest |
11 | 11 | steps: |
12 | | - |
13 | | - # Run Dash Workflow |
14 | | - - name: Trigger Litecoin |
15 | | - uses: actions/github-script@v6 |
16 | | - with: |
17 | | - script: | |
18 | | - github.rest.actions.createWorkflowDispatch({ |
19 | | - owner: context.repo.owner, |
20 | | - repo: context.repo.repo, |
21 | | - workflow_id: 'dash_updater.yml', |
22 | | - ref: context.ref, |
23 | | - inputs: { |
24 | | - logLevel: 'info' |
25 | | - } |
26 | | - }); |
27 | | - # Run Litecoin Workflow |
28 | | - - name: Trigger Litecoin |
| 12 | + - name: Trigger Litecoin Updater |
29 | 13 | uses: actions/github-script@v6 |
30 | 14 | with: |
31 | 15 | script: | |
32 | 16 | github.rest.actions.createWorkflowDispatch({ |
33 | 17 | owner: context.repo.owner, |
34 | 18 | repo: context.repo.repo, |
35 | 19 | workflow_id: 'litecoin_updater.yml', |
36 | | - ref: context.ref, |
37 | | - inputs: { |
38 | | - logLevel: 'info' |
39 | | - } |
| 20 | + ref: context.ref |
40 | 21 | }); |
41 | 22 |
|
42 | | - # Run Dogecoin Workflow |
43 | | - - name: Trigger Dogecoin |
| 23 | + - name: Save Update Time |
| 24 | + run: echo "LITECOIN=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV |
| 25 | + |
| 26 | + dogecoin_updater: |
| 27 | + runs-on: ubuntu-latest |
| 28 | + needs: litecoin_updater |
| 29 | + steps: |
| 30 | + - name: Trigger Dogecoin Updater |
44 | 31 | uses: actions/github-script@v6 |
45 | 32 | with: |
46 | 33 | script: | |
47 | 34 | github.rest.actions.createWorkflowDispatch({ |
48 | 35 | owner: context.repo.owner, |
49 | 36 | repo: context.repo.repo, |
50 | 37 | workflow_id: 'dogecoin_updater.yml', |
51 | | - ref: context.ref, |
52 | | - inputs: { |
53 | | - logLevel: 'info' |
54 | | - } |
| 38 | + ref: context.ref |
55 | 39 | }); |
56 | | - |
57 | | - # Run Bitcoin Cash Workflow |
58 | | - - name: Trigger Bitcoin |
| 40 | +
|
| 41 | + - name: Save Update Time |
| 42 | + run: echo "DOGECOIN=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV |
| 43 | + |
| 44 | + bitcoincash_updater: |
| 45 | + runs-on: ubuntu-latest |
| 46 | + needs: dogecoin_updater |
| 47 | + steps: |
| 48 | + - name: Trigger Bitcoin Cash Updater |
59 | 49 | uses: actions/github-script@v6 |
60 | 50 | with: |
61 | 51 | script: | |
62 | 52 | github.rest.actions.createWorkflowDispatch({ |
63 | 53 | owner: context.repo.owner, |
64 | 54 | repo: context.repo.repo, |
65 | 55 | workflow_id: 'bitcoincash_updater.yml', |
66 | | - ref: context.ref, |
67 | | - inputs: { |
68 | | - logLevel: 'info' |
69 | | - } |
| 56 | + ref: context.ref |
70 | 57 | }); |
71 | | - |
72 | | - # Run Bitcoin Workflow |
73 | | - - name: Trigger Bitcoin |
| 58 | +
|
| 59 | + - name: Save Update Time |
| 60 | + run: echo "BITCOINCASH=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV |
| 61 | + |
| 62 | + bitcoin_updater: |
| 63 | + runs-on: ubuntu-latest |
| 64 | + needs: bitcoincash_updater |
| 65 | + steps: |
| 66 | + - name: Trigger Bitcoin Updater |
74 | 67 | uses: actions/github-script@v6 |
75 | 68 | with: |
76 | 69 | script: | |
77 | 70 | github.rest.actions.createWorkflowDispatch({ |
78 | 71 | owner: context.repo.owner, |
79 | 72 | repo: context.repo.repo, |
80 | 73 | workflow_id: 'bitcoin_updater.yml', |
81 | | - ref: context.ref, |
82 | | - inputs: { |
83 | | - logLevel: 'info' |
84 | | - } |
| 74 | + ref: context.ref |
85 | 75 | }); |
86 | | - |
87 | | - - name: Update Readme Index File |
88 | | - run: envsubst < .github/README.template.md > README.md |
89 | 76 |
|
90 | | - - name: Update Repo |
| 77 | + - name: Save Update Time |
| 78 | + run: echo "BITCOIN=$(date +'%Y-%m-%d %H:%M:%S')" >> $GITHUB_ENV |
| 79 | + |
| 80 | + update_readme: |
| 81 | + runs-on: ubuntu-latest |
| 82 | + needs: bitcoin_updater |
| 83 | + steps: |
| 84 | + - name: Checkout Repository |
| 85 | + uses: actions/checkout@v3 |
| 86 | + |
| 87 | + - name: Replace Variables in README |
| 88 | + run: | |
| 89 | + export UPDATE_TIME_LITECOIN=${LITECOIN} |
| 90 | + export UPDATE_TIME_DOGECOIN=${DOGECOIN} |
| 91 | + export UPDATE_TIME_BITCOINCASH=${BITCOINCASH} |
| 92 | + export UPDATE_TIME=${BITCOIN} |
| 93 | + envsubst < .github/README.template.md > README.md |
| 94 | +
|
| 95 | + - name: Commit and Push Changes |
91 | 96 | run: | |
92 | | - git config --global user.name 'github-actions' |
93 | | - git config --global user.email 'github-actions@github.com' |
94 | | - git add README.md |
95 | | - git commit -m 'Updated : ${{ env.UPDATE_TIME }}' |
96 | | - git push origin main |
| 97 | + git config --global user.name 'github-actions' |
| 98 | + git config --global user.email 'github-actions@github.com' |
| 99 | + git add README.md |
| 100 | + git commit -m "Updated README with latest coin update times" |
| 101 | + git push origin main |
0 commit comments