diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 64617de..d9e0aa4 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -212,11 +212,24 @@ jobs: run: | echo "inside pr_number=$PR_NUMBER" echo "Before pr_number=$PR_NUMBER" - PR_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/pulls" - PR_NUMBER=$(curl -s -H "Accept: application/vnd.github.groot-preview+json" \ + + PR_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/pulls?state=open" + PR_NUMBER=$(curl -s -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: Bearer $GITHUB_TOKEN" \ - $PR_API_URL | jq '.[0].number') - echo "after pr_number=$PR_NUMBER" + $PR_API_URL | jq '.[] | select(.head.sha == "'${GITHUB_SHA}'") | .number') + if [ -z "$PR_NUMBER" ]; then + echo "No PR associated with this commit. Skipping deployment." + exit 0 + fi + echo "PR_NUMBER=$PR_NUMBER" + + + + #PR_API_URL="https://api.github.com/repos/${GITHUB_REPOSITORY}/commits/${GITHUB_SHA}/pulls" + #PR_NUMBER=$(curl -s -H "Accept: application/vnd.github.groot-preview+json" \ + # -H "Authorization: Bearer $GITHUB_TOKEN" \ + # $PR_API_URL | jq '.[0].number') + #echo "after pr_number=$PR_NUMBER" aws s3 sync s3://$S3_BUCKET_NAME/mergeRequest/$PR_NUMBER s3://$S3_BUCKET_NAME/production/ echo "deploy complete to production !!!" # Delete contents of the pr folder diff --git a/docs/index.md b/docs/index.md index 23f9582..12a1919 100644 --- a/docs/index.md +++ b/docs/index.md @@ -10,7 +10,7 @@ author: That Would Be Me # Dec 23 04:15 Updating this line # Dec 23 04:39 Updating this line # Dec 23 04:39 Updating this line -# two +# Dec 23 05:58 Updating this line # one # Change seven 7