Skip to content

Commit 69cc41f

Browse files
committed
Update from source repository
1 parent 58682b1 commit 69cc41f

File tree

2,309 files changed

+1367
-491167
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

2,309 files changed

+1367
-491167
lines changed
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
name: Deploy Workflow to All Branches
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
workflow_path:
7+
description: 'Path to the workflow file to deploy (relative to .github/workflows/)'
8+
required: true
9+
default: 'sync-to-public-mirror.yml'
10+
workflow_content:
11+
description: 'Content of the workflow file (base64 encoded)'
12+
required: true
13+
skip_branches:
14+
description: 'Comma-separated list of branches to skip (optional)'
15+
required: false
16+
default: ''
17+
force_deploy:
18+
description: 'Force deploy even if workflow file exists'
19+
required: false
20+
default: 'true'
21+
type: boolean
22+
use_github_app:
23+
description: 'Use GitHub App token instead of SSH signing (for protected branches)'
24+
required: false
25+
default: 'true'
26+
type: boolean
27+
28+
jobs:
29+
deploy-to-all-branches:
30+
runs-on: ubuntu-latest
31+
permissions:
32+
contents: write
33+
actions: write
34+
steps:
35+
- name: Checkout repository
36+
uses: actions/checkout@v3
37+
with:
38+
fetch-depth: 0
39+
token: ${{ secrets.WORKFLOW_AUTOMATION }}
40+
41+
- name: Set up Git identity
42+
run: |
43+
# Configure git with identity
44+
git config --global user.name "GitHub Actions"
45+
git config --global user.email "[email protected]"
46+
47+
# Disable signing by default - we'll use GitHub's verified commits instead
48+
git config --global commit.gpgsign false
49+
50+
- name: Decode workflow content
51+
run: |
52+
echo "${{ github.event.inputs.workflow_content }}" | base64 -d > workflow_content.yml
53+
mkdir -p .github/workflows
54+
55+
- name: Get all branches and save to file
56+
run: |
57+
# Save branches to a file instead of environment variable
58+
git branch -r | grep -v HEAD | sed 's/origin\///' > all_branches.txt
59+
echo "All branches found:"
60+
cat all_branches.txt
61+
62+
- name: Deploy workflow to all branches
63+
run: |
64+
WORKFLOW_PATH=".github/workflows/${{ github.event.inputs.workflow_path }}"
65+
SKIP_BRANCHES="${{ github.event.inputs.skip_branches }}"
66+
FORCE_DEPLOY="${{ github.event.inputs.force_deploy }}"
67+
USE_GITHUB_APP="${{ github.event.inputs.use_github_app }}"
68+
IFS=',' read -ra SKIP_ARRAY <<< "$SKIP_BRANCHES"
69+
70+
CURRENT_BRANCH=$(git branch --show-current)
71+
echo "Current branch: $CURRENT_BRANCH"
72+
73+
# Process each branch from the file
74+
while read branch; do
75+
# Trim whitespace from branch name
76+
branch=$(echo "$branch" | xargs)
77+
78+
# Skip empty lines
79+
if [ -z "$branch" ]; then
80+
continue
81+
fi
82+
83+
# Check if branch is in skip list
84+
SKIP=false
85+
for skip_branch in "${SKIP_ARRAY[@]}"; do
86+
if [ "$branch" = "$skip_branch" ]; then
87+
SKIP=true
88+
echo "Skipping branch: $branch (in skip list)"
89+
break
90+
fi
91+
done
92+
93+
if [ "$SKIP" = true ]; then
94+
continue
95+
fi
96+
97+
echo "Processing branch: $branch"
98+
99+
# Checkout branch
100+
git checkout "$branch" || { echo "Failed to checkout $branch, skipping"; continue; }
101+
102+
# Enhanced file existence check - check both tracked and untracked files
103+
FILE_EXISTS=false
104+
105+
# Check if the file exists on disk
106+
if [ -f "$WORKFLOW_PATH" ]; then
107+
echo "Workflow file exists on disk in branch $branch"
108+
FILE_EXISTS=true
109+
fi
110+
111+
# Check if the file is untracked by git
112+
UNTRACKED=$(git ls-files --others --exclude-standard "$WORKFLOW_PATH" 2>/dev/null)
113+
if [ -n "$UNTRACKED" ]; then
114+
echo "Workflow file exists but is untracked in branch $branch"
115+
FILE_EXISTS=true
116+
fi
117+
118+
# Check if file is in git's index (tracked)
119+
TRACKED=$(git ls-files "$WORKFLOW_PATH" 2>/dev/null)
120+
if [ -n "$TRACKED" ]; then
121+
echo "Workflow file is tracked by git in branch $branch"
122+
FILE_EXISTS=true
123+
fi
124+
125+
# Act based on file existence and force_deploy flag
126+
if [ "$FILE_EXISTS" = true ] && [ "$FORCE_DEPLOY" != "true" ]; then
127+
echo "Workflow file exists in $branch and force_deploy is not enabled. Skipping."
128+
continue
129+
elif [ "$FILE_EXISTS" = true ] && [ "$FORCE_DEPLOY" = "true" ]; then
130+
echo "Workflow file exists in $branch, but force_deploy is enabled. Overwriting."
131+
else
132+
echo "Workflow file does not exist in $branch. Creating."
133+
fi
134+
135+
# Create directory structure if it doesn't exist
136+
mkdir -p "$(dirname "$WORKFLOW_PATH")"
137+
138+
# Copy workflow file
139+
cp workflow_content.yml "$WORKFLOW_PATH"
140+
141+
# Add diagnostic output to verify file was created
142+
echo "Verifying workflow file was created:"
143+
ls -la "$WORKFLOW_PATH" || echo "Error: File not found after creation"
144+
145+
# Check if file is in .gitignore
146+
if grep -q "$WORKFLOW_PATH" .gitignore 2>/dev/null; then
147+
echo "WARNING: The workflow path '$WORKFLOW_PATH' appears to be in .gitignore"
148+
echo "This could prevent git from tracking the file"
149+
fi
150+
151+
# Add the file and check if it was added successfully
152+
git add "$WORKFLOW_PATH"
153+
if ! git ls-files --stage | grep -q "$WORKFLOW_PATH"; then
154+
echo "WARNING: Failed to add file to git index. File may be ignored by gitignore rules."
155+
echo "Attempting to force-add the file..."
156+
git add -f "$WORKFLOW_PATH"
157+
fi
158+
159+
# Verify the file is now in the index
160+
if git ls-files --stage | grep -q "$WORKFLOW_PATH"; then
161+
echo "File successfully added to git index"
162+
else
163+
echo "ERROR: Still unable to add file to git index despite force-add attempt"
164+
echo "This suggests a strong gitignore rule or other git configuration issue"
165+
continue
166+
fi
167+
168+
# Commit changes
169+
echo "Committing changes"
170+
if ! git commit -m "Add workflow file to branch $branch"; then
171+
echo "No changes to commit for $branch or commit failed"
172+
continue
173+
fi
174+
175+
if ! git push origin "$branch"; then
176+
echo "Failed to push changes to $branch"
177+
echo "This branch may be protected and require verified commits."
178+
continue
179+
fi
180+
181+
echo "Successfully deployed workflow to $branch"
182+
done < all_branches.txt
183+
184+
# Return to original branch
185+
git checkout "$CURRENT_BRANCH"
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: Remove Workflow from All Branches
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
workflow_path:
7+
description: 'Path to the workflow file to remove (relative to .github/workflows/)'
8+
required: true
9+
default: 'sync-to-public-mirror.yml'
10+
skip_branches:
11+
description: 'Comma-separated list of branches to skip (optional)'
12+
required: false
13+
default: ''
14+
dry_run:
15+
description: 'Dry run (will not make actual changes)'
16+
required: false
17+
default: false
18+
type: boolean
19+
20+
jobs:
21+
remove-from-all-branches:
22+
runs-on: ubuntu-latest
23+
permissions:
24+
contents: write
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v3
28+
with:
29+
fetch-depth: 0
30+
# Need to use PAT for workflow files
31+
token: ${{ secrets.WORKFLOW_AUTOMATION }}
32+
33+
- name: Set up Git identity
34+
run: |
35+
git config --global user.name "GitHub Actions"
36+
git config --global user.email "[email protected]"
37+
38+
- name: Get all branches and save to file
39+
run: |
40+
# Save branches to a file
41+
git branch -r | grep -v HEAD | sed 's/origin\///' > all_branches.txt
42+
echo "All branches found:"
43+
cat all_branches.txt
44+
45+
- name: Remove workflow from all branches
46+
run: |
47+
WORKFLOW_PATH=".github/workflows/${{ github.event.inputs.workflow_path }}"
48+
WORKFLOW_DIR=".github/workflows"
49+
GITHUB_DIR=".github"
50+
SKIP_BRANCHES="${{ github.event.inputs.skip_branches }}"
51+
DRY_RUN="${{ github.event.inputs.dry_run }}"
52+
53+
IFS=',' read -ra SKIP_ARRAY <<< "$SKIP_BRANCHES"
54+
55+
CURRENT_BRANCH=$(git branch --show-current)
56+
echo "Current branch: $CURRENT_BRANCH"
57+
58+
# Process each branch from the file
59+
while read branch; do
60+
# Trim whitespace from branch name
61+
branch=$(echo "$branch" | xargs)
62+
63+
# Skip empty lines
64+
if [ -z "$branch" ]; then
65+
continue
66+
fi
67+
68+
# Check if branch is in skip list
69+
SKIP=false
70+
for skip_branch in "${SKIP_ARRAY[@]}"; do
71+
if [ "$branch" = "$skip_branch" ]; then
72+
SKIP=true
73+
echo "Skipping branch: $branch (in skip list)"
74+
break
75+
fi
76+
done
77+
78+
if [ "$SKIP" = true ]; then
79+
continue
80+
fi
81+
82+
echo "Processing branch: $branch"
83+
84+
# Checkout branch
85+
git checkout "$branch" || { echo "Failed to checkout $branch, skipping"; continue; }
86+
87+
# Check if workflow file exists
88+
if [ ! -f "$WORKFLOW_PATH" ]; then
89+
echo "Workflow file doesn't exist in $branch. Skipping."
90+
continue
91+
fi
92+
93+
echo "Found workflow file in branch: $branch"
94+
95+
# Check if we're doing a dry run
96+
if [ "$DRY_RUN" = "true" ]; then
97+
echo "DRY RUN: Would remove $WORKFLOW_PATH from branch $branch"
98+
continue
99+
fi
100+
101+
# Remove the workflow file
102+
rm "$WORKFLOW_PATH"
103+
104+
# Check if workflows directory is empty
105+
if [ -d "$WORKFLOW_DIR" ] && [ -z "$(ls -A $WORKFLOW_DIR)" ]; then
106+
echo "Workflows directory is empty, removing it"
107+
rm -rf "$WORKFLOW_DIR"
108+
109+
# Check if .github directory is empty
110+
if [ -d "$GITHUB_DIR" ] && [ -z "$(ls -A $GITHUB_DIR)" ]; then
111+
echo "GitHub directory is empty, removing it"
112+
rm -rf "$GITHUB_DIR"
113+
fi
114+
fi
115+
116+
# Commit and push changes
117+
git add -A
118+
git commit -m "Remove workflow file from branch $branch" || echo "No changes to commit for $branch"
119+
git push origin "$branch" || echo "Failed to push changes to $branch"
120+
121+
echo "Successfully removed workflow from $branch"
122+
done < all_branches.txt
123+
124+
# Return to original branch
125+
git checkout "$CURRENT_BRANCH"

404.adoc

Lines changed: 0 additions & 11 deletions
This file was deleted.

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
# thoughtspot-docs
1+
# ThoughtSpot Cloud, Software, and Mobile documentation repository
2+
3+
© COPYRIGHT 2025 THOUGHTSPOT, INC. ALL RIGHTS RESERVED.
4+
These documents may not, in whole or in part, be copied, photocopied, reproduced, translated, or reduced to any electronic medium or machine-readable form without prior consent in writing from ThoughtSpot, Inc.

0 commit comments

Comments
 (0)