@@ -16,10 +16,16 @@ jobs:
16
16
runs-on : ubuntu-latest
17
17
env :
18
18
ACTING_SHA : ${{ github.sha }}
19
- POSITION_FROM_TOP : 1
19
+ POSITION_FROM_TOP : 2
20
20
OUTPUT_NAME : ' machinekit-site-${{ github.sha }}'
21
21
ACTING_REPOSITORY : ${{ github.repository }}
22
22
steps :
23
+ # Hack uptil conditional setting of environment variable is posible
24
+ # (or this is reworked into an action)
25
+ - name : Test for pull request or push
26
+ if : github.event_name == 'push'
27
+ run : echo ::set-env name=POSITION_FROM_TOP::1
28
+
23
29
# Locally clone the repository which we want to build with depth of 5 commits
24
30
- name : Checkout the pull request for Machinekit-docs
25
31
uses : actions/checkout@v2
33
39
run : echo ${{ env.ACTING_SHA }}
34
40
35
41
- name : Git log of repository on which the build is requested
36
- run : git log
42
+ run : |
43
+ git log
44
+ echo "WHERE is HEAD"
45
+ git log HEAD
37
46
working-directory : ./to_build
38
47
39
48
# Create directory for output files and export it's name as a environment variable
@@ -49,12 +58,13 @@ jobs:
49
58
- name : Create JSON with commit metadata
50
59
env :
51
60
FILENAME : ' $OUTPUT_DIRECTORY/build-metadata.json'
61
+ shell : bash
52
62
run : |
53
63
echo "###########################################################"
54
64
echo "# Commit which will be used for mining of the credentials #"
55
65
echo "###########################################################"
56
- git log -n 1 ${{ env.ACTING_SHA }} ~$((${{ env.POSITION_FROM_TOP }}-1))
57
- jq -n --arg authoremail "$(git log --format='%ae' -n 1 ${{ env.ACTING_SHA }} ~$((${{ env.POSITION_FROM_TOP }}-1)))" --arg authorname "$(git log --format='%an' -n 1 ${{ env.ACTING_SHA }} ~$((${{ env.POSITION_FROM_TOP }}-1)))" --arg commitmsg "$(git log --format='%B' -n 1 ${{ env.ACTING_SHA }} ~$((${{ env.POSITION_FROM_TOP }}-1)))" --arg sha "${{ env.ACTING_SHA }}" '{"author":"\($authorname)","email":"\($authoremail)","message":"\($commitmsg)","sha":"\($sha)"}' > ${{ env.FILENAME }}
66
+ git log -n 1 $(echo HEAD ~$((${{ env.POSITION_FROM_TOP }}-1) ))
67
+ jq -n --arg authoremail "$(git log --format='%ae' -n 1 $(echo HEAD ~$((${{ env.POSITION_FROM_TOP }}-1)))) " --arg authorname "$(git log --format='%an' -n 1 $(echo HEAD ~$((${{ env.POSITION_FROM_TOP }}-1)))) " --arg commitmsg "$(git log --format='%B' -n 1 $(echo HEAD ~$((${{ env.POSITION_FROM_TOP }}-1) )))" --arg sha "${{ env.ACTING_SHA }}" '{"author":"\($authorname)","email":"\($authoremail)","message":"\($commitmsg)","sha":"\($sha)"}' > ${{ env.FILENAME }}
58
68
echo "###########################################################"
59
69
echo "# JSON file with metadata information of pertinent commit #"
60
70
echo "###########################################################"
0 commit comments