-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (55 loc) · 2.21 KB
/
test-exports.yml
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
name: Test Exports
on:
push:
paths:
- '.github/workflows/test-exports.yml'
jobs:
first-job:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- id: identify
run: |
# use bash variable expression to get the substring
export GIT_PR_SHA="${{ github.sha }}"
export GIT_PR_SHA_SHORT="${GIT_PR_SHA:0:10}"
echo "::set-output name=git_pr_sha::${GIT_PR_SHA}"
echo "::set-output name=git_pr_sha_short::${GIT_PR_SHA_SHORT}"
- id: get_consumers
uses: notiz-dev/github-action-json-property@release
with:
path: 'consumers-donotedit.json'
prop_path: 'lodash'
- run: |
export CONSUMERS="${{steps.get_consumers.outputs.prop}}"
echo "notiz export: ${CONSUMERS}"
echo "::set-output name=consumers::[${CONSUMERS}]"
- id: jq_consumers
run: |
export JQ_CONSUMER=$(jq '.lodash' <<< $(cat ./consumers-donotedit.json))
echo "jq export: $JQ_CONSUMER"
echo "::set-output name=jqConsumers::$JQ_CONSUMER"
# export jqcs=$(jq '.lodash' <<< $(cat ./consumers-donotedit.json))
- name: Set env
run: echo "GITHUB_SHA_SHORT=$(echo $GITHUB_SHA | cut -c 1-6)" >> $GITHUB_ENV
- name: Test
run: |
echo $GITHUB_SHA_SHORT
echo "github_env: $GITHUB_SHA_SHORT"
outputs:
git_pr_sha: ${{ steps.identify.outputs.git_pr_sha }}
git_pr_sha_short: ${{ steps.identify.outputs.git_pr_sha_short }}
consumersNoitzDev: ${{ steps.get_consumers.outputs.consumers }}
jqConsumers: ${{ steps.jq_consumers.outputs.jqConsumers }}
second-job:
needs: first-job
runs-on: ubuntu-latest
steps:
- run: |
echo "${{ needs.first-job.outputs.git_pr_sha }}"
echo "${{ needs.first-job.outputs.git_pr_sha_short }}"
echo "jq export: ${{ needs.first-job.outputs.jqConsumers }}"
echo "notiz export: ${{ needs.first-job.outputs.consumersNoitzDev }}"
# echo "fromJson notiz export: ${{ fromJson(needs.first-job.outputs.consumersNoitzDev) }}"
# echo "fromJson jq export: ${{ fromJson(needs.first-job.outputs.jqConsumers) }}"
# echo "from GITHUB_ENV: $GITHUB_SHA_SHORT" # prints nothing