File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 7676 permissions :
7777 id-token : write
7878 contents : read
79+ deployments : read
7980 concurrency :
8081 group : ${{ github.event.repository.name }}-dev-env
8182 cancel-in-progress : false
@@ -123,7 +124,36 @@ jobs:
123124 role-session-name : Core_Dev_Deployment_${{ github.run_id }}
124125 aws-region : us-east-1
125126
127+ - name : Get latest deployment SHA
128+ id : get_last_deploy
129+ uses : actions/github-script@v7
130+ with :
131+ script : |
132+ const deployments = await github.rest.repos.listDeployments({
133+ owner: context.repo.owner,
134+ repo: context.repo.repo,
135+ environment: 'AWS DEV',
136+ per_page: 1
137+ });
138+ if (deployments.data.length > 0) {
139+ return deployments.data[0].sha;
140+ }
141+ return null;
142+
143+ - name : Determine deployment status
144+ id : check_commits
145+ run : |
146+ echo "Last deployed SHA: ${{ steps.get_last_deploy.outputs.result }}"
147+ echo "Current SHA: ${{ github.sha }}"
148+ if [ "${{ steps.get_last_deploy.outputs.result }}" == "${{ github.sha }}" ]; then
149+ echo "This commit is already deployed to AWS DEV. Skipping deployment."
150+ echo "should_deploy=false" >> $GITHUB_OUTPUT
151+ else
152+ echo "New commit detected. Proceeding with deployment."
153+ echo "should_deploy=true" >> $GITHUB_OUTPUT
154+ fi
126155 - name : Publish to AWS
156+ if : steps.check_commits.outputs.should_deploy == 'true'
127157 run : make deploy_dev
128158 env :
129159 HUSKY : " 0"
You can’t perform that action at this time.
0 commit comments