File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -37,6 +37,10 @@ inputs:
3737 description : ' Prefix to add to generated docker tag'
3838 required : false
3939 default : ' '
40+ GITHUB_TOKEN :
41+ description : ' Github token of the repository (automatically created by Github)'
42+ default : ${{ github.token }}
43+ required : false
4044outputs :
4145 tag : # id of output
4246 description : ' Tag used for the docker image'
@@ -103,3 +107,14 @@ runs:
103107 - name : Image digest
104108 run : echo ${{ steps.docker_build.outputs.digest }}
105109 shell : bash
110+ - name : Comment latest docker image
111+ if : github.event_name == 'pull_request'
112+ shell : bash
113+ run : |
114+ # Use GitHub API to create a comment on the PR
115+ PR_NUMBER=${{ github.event.pull_request.number }}
116+ COMMENT='Docker image built: `${{ steps.meta.outputs.tags }}`'
117+ GITHUB_TOKEN=${{ inputs.GITHUB_TOKEN }}
118+ COMMENT_URL="https://api.github.com/repos/${{ github.repository }}/issues/${PR_NUMBER}/comments"
119+
120+ curl -s -H "Authorization: token ${GITHUB_TOKEN}" -X POST $COMMENT_URL -d "{\"body\":\"${COMMENT}\"}"
You can’t perform that action at this time.
0 commit comments