adding sha info (#1272)

* adding sha info

* add the code
This commit is contained in:
Lukas Gravley 2021-02-26 13:17:45 -06:00 committed by GitHub
parent 337504c75b
commit f84d16fda0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 2 deletions

View file

@ -22,6 +22,7 @@ VERSION='' # Version of release pulled from api
ACTION_FILE='action.yml' # Action file to update ACTION_FILE='action.yml' # Action file to update
PR_ID='' # PUll Request ID when created PR_ID='' # PUll Request ID when created
UPDATED_BODY_STRING='' # Issue body string converted UPDATED_BODY_STRING='' # Issue body string converted
COMMIT_SHA='' # COmmit sha when PR is created
############## ##############
# Built Vars # # Built Vars #
@ -152,6 +153,22 @@ CommitAndPush() {
fi fi
done done
# get the current commit sha
COMMIT_SHA=$(git rev-parse --short HEAD 2>&1)
# Load the error code
ERROR_CODE=$?
# Check the shell for errors
if [ "${ERROR_CODE}" -ne 0 ]; then
# ERROR
echo "ERROR! Failed to get comit sha!"
echo "ERROR:[$COMMIT_SHA]"
exit 1
else
echo "Successfully grabbed commit sha"
fi
} }
################################################################################ ################################################################################
#### Function UpdateBaseIssue ################################################## #### Function UpdateBaseIssue ##################################################
@ -256,6 +273,9 @@ SetActionsVariables() {
echo "Setting PR_REF:[Automation-Release-${VERSION}]" echo "Setting PR_REF:[Automation-Release-${VERSION}]"
echo "PR_REF=Automation-Release-${VERSION}" >>"${GITHUB_ENV}" echo "PR_REF=Automation-Release-${VERSION}" >>"${GITHUB_ENV}"
echo "Setting COMMIT_SHA:[${COMMIT_SHA}]"
echo "COMMIT_SHA=${COMMIT_SHA}" >>"${GITHUB_ENV}"
} }
################################################################################ ################################################################################
#### Function Footer ########################################################### #### Function Footer ###########################################################

View file

@ -110,7 +110,7 @@ jobs:
- name: Update actions.yml with release version and create PR - name: Update actions.yml with release version and create PR
if: success() if: success()
run: ./.automation/update-actions-version.sh run: ./.automation/update-actions-version.sh
# Note: script creates variables: PR_ID PR_REF RELEASE_VERSION # Note: script creates variables: PR_ID PR_REF RELEASE_VERSION COMMIT_SHA
env: env:
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@ -158,6 +158,17 @@ jobs:
draft: false draft: false
prerelease: false prerelease: false
#####################################################
# Create the Required status check for Stack Linter #
#####################################################
- name: Create Stack Linter Status
if: success()
run: |
curl -X POST --url https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.COMMIT_SHA }} \
-H "Accept: application/vnd.github.v3+json" \
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
--data '{ "state": "success", "context": "Stack linter" }'
################################# #################################
# Close the opened Pull Request # # Close the opened Pull Request #
################################# #################################
@ -180,4 +191,4 @@ jobs:
token: ${{ secrets.GITHUB_TOKEN }} token: ${{ secrets.GITHUB_TOKEN }}
status: ${{ job.status }} status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }} deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: https://github.com/orgs/${{github.repository_owner}}/packages?repo_name=${{github.repository.name}} env_url: https://github.com/orgs/${{github.repository_owner}}/container/package/${{github.repository.name}}