From 980e9f9b402126c791bd5dbc365b4262388580c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jakub=20Fi=C5=A1er?= Date: Mon, 24 Feb 2020 20:00:12 +0100 Subject: [PATCH 1/2] Repair getting the right commit for build-metadata --- .github/workflows/build-preview-pages.yaml | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build-preview-pages.yaml b/.github/workflows/build-preview-pages.yaml index f28468877d..e85de6cb39 100644 --- a/.github/workflows/build-preview-pages.yaml +++ b/.github/workflows/build-preview-pages.yaml @@ -16,10 +16,16 @@ jobs: runs-on: ubuntu-latest env: ACTING_SHA: ${{ github.sha }} - POSITION_FROM_TOP: 1 + POSITION_FROM_TOP: '1' OUTPUT_NAME: 'machinekit-site-${{ github.sha }}' ACTING_REPOSITORY: ${{ github.repository }} steps: + # Hack uptil conditional setting of environment variable is posible + # (or this is reworked into an action) + - name: Test for pull request or push + if: github.event_name == 'push' + run: echo ::set-env name=POSITION_FROM_TOP::1 + # Locally clone the repository which we want to build with depth of 5 commits - name: Checkout the pull request for Machinekit-docs uses: actions/checkout@v2 @@ -33,7 +39,13 @@ jobs: run: echo ${{ env.ACTING_SHA }} - name: Git log of repository on which the build is requested - run: git log + run: | + git log + echo "WHERE is HEAD" + git log HEAD + echo "" + echo "HEAD~1" + git log HEAD~1 working-directory: ./to_build # Create directory for output files and export it's name as a environment variable @@ -49,12 +61,13 @@ jobs: - name: Create JSON with commit metadata env: FILENAME: '$OUTPUT_DIRECTORY/build-metadata.json' + shell: bash run: | echo "###########################################################" echo "# Commit which will be used for mining of the credentials #" echo "###########################################################" - git log -n 1 ${{ env.ACTING_SHA }}~$((${{ env.POSITION_FROM_TOP }}-1)) - 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 }} + git log -n 1 $(echo HEAD~${{ env.POSITION_FROM_TOP }}) + 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 }} echo "###########################################################" echo "# JSON file with metadata information of pertinent commit #" echo "###########################################################" From c6f5a942d7616f22358673c402d61954e0ab43d0 Mon Sep 17 00:00:00 2001 From: Lanovka na Javor Date: Mon, 24 Feb 2020 21:29:31 +0100 Subject: [PATCH 2/2] New test --- newtest.html | 1 + 1 file changed, 1 insertion(+) create mode 100644 newtest.html diff --git a/newtest.html b/newtest.html new file mode 100644 index 0000000000..1df1bc9b5c --- /dev/null +++ b/newtest.html @@ -0,0 +1 @@ +New Test