This action is based on the action created here, the only difference is that this action do not check against ref.name against the branch which is causing our Heroku deployments some issue.
Use this action to get the commit SHA of latest active deployment in a Github repository.
NOTE:
⚠️ The github action job need to explicitly add permissiondeployments: readto read the deployments.⚠️ The action fetches latest 25 deployments and find the deployment which is ACTIVE and from the given environment and branch.
repo_owner: (required) Owner of the reepository.repo_name: (required) Name of the reepository.environment: (required) Deployment environment.branch: (optional) To find the latest deployment in specified branch. Default branch is main.
sha: Commit sha of latest ACTIVE deployment.
jobs:
sample-job:
name: Get the latest deployment sha
runs-on: ubuntu-latest
permissions:
deployments: read
contents: read
steps:
- name: Checkout
id: checkout
uses: actions/checkout@v3
- name: Get sha of latest deployment in main branch
id: latest-deployment-sha
uses: ABI-Software/get-latest-deployment-sha@v1.0.0
with:
repo_owner: ABI-Sofeware
repo_name: latest-deployment-sha
environment: production
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Print latest deployment sha
id: output
run: echo "${{ steps.latest-deployment-sha.outputs.sha }}"The scripts and documentation in this project are released under the MIT License
This script is forked from https://github.com/vrnithinkumar/latest-deployment-sha, thanks for the development.