forked from AlexStormwood/CommitsWithinTime
-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.69 KB
/
main.yml
File metadata and controls
74 lines (64 loc) · 2.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
name: Check commits
on: [push]
jobs:
example_check_commits_job:
runs-on: ubuntu-latest
name: Check for commits within the last 1 hours
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout with maximum fetch depth
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Run CommitsWithinTime script
uses: ./ # Uses an action in the root directory
id: commitswithintime
with:
hours: 1
exportToFile: true
# Use the output from the `hello` step
- name: Get the output from CommitsWithinTime
run: |
echo "The 'has-new-commits-within-time' value is ${{ steps.commitswithintime.outputs.has-new-commits-within-time }}"
echo "The 'number-of-commits-within-time' value is ${{ steps.commitswithintime.outputs.number-of-commits-within-time }}"
echo "The 'total-commits' value is ${{ steps.commitswithintime.outputs.total-commits }}"
example_check_data_from_other_job:
needs: example_check_commits_job
runs-on: ubuntu-latest
name: Check for data from artifact created by other job
steps:
# To use this repository's private action,
# you must check out the repository
- name: Checkout with maximum fetch depth
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download a single artifact
uses: actions/download-artifact@v2
with:
name: outputCommitsWithinTime
path: exampleDownloadOfArtifactData
- name: Read total commits from artifact JSON
id: getTotalCommits
uses: notiz-dev/github-action-json-property@release
with:
path: 'exampleDownloadOfArtifactData/CommitsWithinTime/outputFromCommitsWithinTime.json'
prop_path: "totalCommits"
- name: Read hasNewCommitsWithinTime from artifact JSON
id: getHasNewCommits
uses: notiz-dev/github-action-json-property@release
with:
path: 'exampleDownloadOfArtifactData/CommitsWithinTime/outputFromCommitsWithinTime.json'
prop_path: "hasNewCommitsWithinTime"
- name: Read new commits from artifact JSON
id: getNewCommitsCount
uses: notiz-dev/github-action-json-property@release
with:
path: 'exampleDownloadOfArtifactData/CommitsWithinTime/outputFromCommitsWithinTime.json'
prop_path: "numberOfCommitsWithinTime"
- name: Echo data read from artifact
run: |
echo ${{steps.getTotalCommits.outputs.prop}}
echo ${{steps.getHasNewCommits.outputs.prop}}
echo ${{steps.getNewCommitsCount.outputs.prop}}