Skip to content

vrnithinkumar/latest-deployment-sha

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Github action to get the commit of latest active deployment

GitHub Super-Linter CI

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 permission deployments: read to read the deployments.
  • ⚠️ The action fetches latest 25 deployments and find the deployment which is ACTIVE and from the given environment and branch.

Inputs

  • 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.

Outputs

  • sha: Commit sha of latest ACTIVE deployment.

Usage

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 }}"

License

The scripts and documentation in this project are released under the MIT License

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published