Skip to content

Commit

Permalink
DAT-19181 GitHub Actions Error: uploading S3 Object to Bucket (#285)
Browse files Browse the repository at this point in the history
* ✨ (send-docs-redirects-to-staging.yml): add a check for website_redirect format to ensure all values start with a forward slash for consistency and correctness in redirect paths

* πŸ“ (variables.tf): add a comment to indicate the need for a list of redirects from team members to clarify requirements

* πŸ“ (send-docs-redirects-to-staging.yml): improve validation for website_redirect format to ensure it starts with '/' or 'http'
πŸ’‘ (variables.tf): remove unnecessary trailing whitespace for cleaner code

* πŸ“ (variables.tf): add a comment placeholder for obtaining redirect list from team members

* ♻️ (variables.tf): update redirect path to remove leading slash for consistency in URL formatting

* ♻️ (variables.tf): update redirect path to include leading slash for consistency and correctness in URL structure

* ✨ (send-enterprise-redirects-to-staging.yml): add a step to check the format of website_redirect entries to ensure valid URLs
πŸ’‘ (send-enterprise-redirects-to-staging.yml): provide error messages and examples for invalid website_redirect formats to guide users
  • Loading branch information
jandroav authored Dec 12, 2024
1 parent 2c1bc44 commit b48b79b
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/send-docs-redirects-to-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,23 @@ jobs:
role-to-assume: ${{ secrets.AWS_ADMIN_GITHUB_OIDC_ROLE_ARN_DOCS }}
aws-region: us-east-1

- name: Check website redirects format
run: |
INVALID_REDIRECTS=$(grep -P 'website_redirect\s*=\s*"[^/h]|website_redirect\s*=\s*"h(?!ttps?://)' variables.tf || true)
if [ ! -z "$INVALID_REDIRECTS" ]; then
echo "❌ Error: Found website_redirect entries with invalid format:"
echo "----------------------------------------"
echo "$INVALID_REDIRECTS" | while read -r line; do
echo -e "\033[31m$line\033[0m"
done
echo "----------------------------------------"
echo "website_redirect must start with either '/' or 'http'"
echo "Examples:"
echo " website_redirect = \"/home.html\""
echo " website_redirect = \"https://example.com\""
exit 1
fi
- name: Terraform Format
if: ${{ github.event_name == 'pull_request' }}
id: fmt
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/send-enterprise-redirects-to-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ jobs:
role-to-assume: ${{ secrets.AWS_ADMIN_GITHUB_OIDC_ROLE_ARN_DOCS }}
aws-region: us-east-1

- name: Check website redirects format
run: |
INVALID_REDIRECTS=$(grep -P 'website_redirect\s*=\s*"[^/h]|website_redirect\s*=\s*"h(?!ttps?://)' variables.tf || true)
if [ ! -z "$INVALID_REDIRECTS" ]; then
echo "❌ Error: Found website_redirect entries with invalid format:"
echo "----------------------------------------"
echo "$INVALID_REDIRECTS" | while read -r line; do
echo -e "\033[31m$line\033[0m"
done
echo "----------------------------------------"
echo "website_redirect must start with either '/' or 'http'"
echo "Examples:"
echo " website_redirect = \"/home.html\""
echo " website_redirect = \"https://example.com\""
exit 1
fi
- name: Terraform Format
if: ${{ github.event_name == 'pull_request' }}
id: fmt
Expand Down

0 comments on commit b48b79b

Please sign in to comment.