@@ -16,10 +16,16 @@ jobs:
1616 runs-on : ubuntu-latest
1717 env :
1818 ACTING_SHA : ${{ github.sha }}
19- POSITION_FROM_TOP : 1
19+ POSITION_FROM_TOP : ' 1 '
2020 OUTPUT_NAME : ' machinekit-site-${{ github.sha }}'
2121 ACTING_REPOSITORY : ${{ github.repository }}
2222 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+
2329 # Locally clone the repository which we want to build with depth of 5 commits
2430 - name : Checkout the pull request for Machinekit-docs
2531 uses : actions/checkout@v2
3339 run : echo ${{ env.ACTING_SHA }}
3440
3541 - 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
46+ echo ""
47+ echo "HEAD~1"
48+ git log HEAD~1
3749 working-directory : ./to_build
3850
3951 # Create directory for output files and export it's name as a environment variable
@@ -49,12 +61,13 @@ jobs:
4961 - name : Create JSON with commit metadata
5062 env :
5163 FILENAME : ' $OUTPUT_DIRECTORY/build-metadata.json'
64+ shell : bash
5265 run : |
5366 echo "###########################################################"
5467 echo "# Commit which will be used for mining of the credentials #"
5568 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 }}
69+ git log -n 1 $(echo HEAD~$ {{ env.POSITION_FROM_TOP }})
70+ jq -n --arg authoremail "$(git log --format='%ae' -n 1 $(echo HEAD~$ {{ env.POSITION_FROM_TOP }})) " --arg authorname "$(git log --format='%an' -n 1 $(echo HEAD~$ {{ env.POSITION_FROM_TOP }})) " --arg commitmsg "$(git log --format='%B' -n 1 $(echo HEAD~$ {{ env.POSITION_FROM_TOP }}))" --arg sha "${{ env.ACTING_SHA }}" '{"author":"\($authorname)","email":"\($authoremail)","message":"\($commitmsg)","sha":"\($sha)"}' > ${{ env.FILENAME }}
5871 echo "###########################################################"
5972 echo "# JSON file with metadata information of pertinent commit #"
6073 echo "###########################################################"
0 commit comments