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: vrnithinkumar/[email protected]
with:
repo_owner: vrnithinkumar
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