From a2bdc94f00237049285986321dfc7a0547bb3d8b Mon Sep 17 00:00:00 2001 From: Alistair Hey Date: Fri, 11 Dec 2020 21:21:00 +0000 Subject: [PATCH] Fix parsing github commit status to container There was an instance of the git commit message not being passed correctly to the build, thus returning nil on the faas-cli version command. Tested on a failing commit by amending the commit (keeping message) and getting CI to run green Signed-off-by: Alistair Hey --- .github/workflows/build.yml | 10 ++++++++-- .github/workflows/publish.yml | 5 ++++- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8ccd6a68..e1c5ded4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,6 +35,9 @@ jobs: - name: Get Repo Owner id: get_repo_owner run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + - name: Get Commit Message + id: get_commit_message + run: echo ::set-output name=commit_message::$(git log -1 --pretty=%B 2>&1 | head -n 1) - name: Build Gateway uses: docker/build-push-action@v2 with: @@ -46,7 +49,7 @@ jobs: build-args: | VERSION=${{ steps.get_tag.outputs.TAG }} GIT_COMMIT=${{ github.sha }} - GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }} + GIT_COMMIT_MESSAGE=${{ steps.get_commit_message.outputs.commit_message }} tags: | ghcr.io/openfaas/gateway:latest-dev - name: Run CI @@ -71,6 +74,9 @@ jobs: - name: Get Repo Owner id: get_repo_owner run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + - name: Get Commit Message + id: get_commit_message + run: echo ::set-output name=commit_message::$(git log -1 --pretty=%B 2>&1 | head -n 1) - name: Build ${{ matrix.svc }} uses: docker/build-push-action@v2 with: @@ -81,7 +87,7 @@ jobs: build-args: | VERSION=${{ steps.get_tag.outputs.TAG }} GIT_COMMIT=${{ github.sha }} - GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }} + GIT_COMMIT_MESSAGE=${{ steps.get_commit_message.outputs.commit_message }} tags: | ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ steps.get_tag.outputs.TAG }} ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ github.sha }} diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 0a5a7ed8..ae171e96 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -32,6 +32,9 @@ jobs: - name: Get Repo Owner id: get_repo_owner run: echo ::set-output name=repo_owner::$(echo ${{ github.repository_owner }} | tr '[:upper:]' '[:lower:]') + - name: Get Commit Message + id: get_commit_message + run: echo ::set-output name=commit_message::$(git log -1 --pretty=%B 2>&1 | head -n 1) - name: Publish ${{ matrix.svc }} uses: docker/build-push-action@v2 with: @@ -42,7 +45,7 @@ jobs: build-args: | VERSION=${{ steps.get_tag.outputs.TAG }} GIT_COMMIT=${{ github.sha }} - GIT_COMMIT_MESSAGE=${{ github.event.head_commit.message }} + GIT_COMMIT_MESSAGE="${{ steps.get_commit_message.outputs.commit_message }}" tags: | ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ steps.get_tag.outputs.TAG }} ghcr.io/${{ steps.get_repo_owner.outputs.repo_owner }}/gateway:${{ github.sha }}