Compare commits
2 Commits
claude/ado
...
claude/ima
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9202f81a90 | ||
|
|
5eb9e598b3 |
17
.github/workflows/cto-review.yml
vendored
17
.github/workflows/cto-review.yml
vendored
@@ -123,18 +123,17 @@ jobs:
|
|||||||
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=50
|
git fetch origin ${{ github.event.pull_request.base.ref }} --depth=50
|
||||||
BASE_SHA="${{ github.event.pull_request.base.sha }}"
|
BASE_SHA="${{ github.event.pull_request.base.sha }}"
|
||||||
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
HEAD_SHA="${{ github.event.pull_request.head.sha }}"
|
||||||
# Write the diff to a file, not a step output / env var. Passing a
|
DIFF=$(git diff --no-color "$BASE_SHA" "$HEAD_SHA" | head -c 400000)
|
||||||
# ~400KB diff through the process env (execve argv+envp) exceeds the
|
|
||||||
# runner ARG_MAX and fails the next step with "Argument list too long"
|
|
||||||
# (issue #110). File transport also sidesteps the ~1MB step-output cap.
|
|
||||||
git diff --no-color "$BASE_SHA" "$HEAD_SHA" | head -c 400000 > /tmp/cto-review-diff.txt
|
|
||||||
FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
|
FILES=$(git diff --name-only "$BASE_SHA" "$HEAD_SHA")
|
||||||
SIZE=$(wc -c < /tmp/cto-review-diff.txt)
|
SIZE=$(echo -n "$DIFF" | wc -c)
|
||||||
{
|
{
|
||||||
echo "size=$SIZE"
|
echo "size=$SIZE"
|
||||||
echo "files<<EOF_FILES"
|
echo "files<<EOF_FILES"
|
||||||
echo "$FILES"
|
echo "$FILES"
|
||||||
echo "EOF_FILES"
|
echo "EOF_FILES"
|
||||||
|
echo "diff<<EOF_DIFF"
|
||||||
|
echo "$DIFF"
|
||||||
|
echo "EOF_DIFF"
|
||||||
} >> "$GITHUB_OUTPUT"
|
} >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
- name: Load repo conventions
|
- name: Load repo conventions
|
||||||
@@ -162,7 +161,7 @@ jobs:
|
|||||||
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
PR_NUMBER: ${{ github.event.pull_request.number }}
|
||||||
REPO_NAME: ${{ github.event.repository.name }}
|
REPO_NAME: ${{ github.event.repository.name }}
|
||||||
DIFF_PATH: /tmp/cto-review-diff.txt
|
DIFF: ${{ steps.diff.outputs.diff }}
|
||||||
DIFF_SIZE: ${{ steps.diff.outputs.size }}
|
DIFF_SIZE: ${{ steps.diff.outputs.size }}
|
||||||
CHANGED_FILES: ${{ steps.diff.outputs.files }}
|
CHANGED_FILES: ${{ steps.diff.outputs.files }}
|
||||||
CONVENTIONS: ${{ steps.conventions.outputs.content }}
|
CONVENTIONS: ${{ steps.conventions.outputs.content }}
|
||||||
@@ -230,9 +229,7 @@ jobs:
|
|||||||
user_blocks.append(f"**Changed files:**\n```\n{os.environ['CHANGED_FILES']}\n```\n")
|
user_blocks.append(f"**Changed files:**\n```\n{os.environ['CHANGED_FILES']}\n```\n")
|
||||||
if os.environ.get("CONVENTIONS", "").strip():
|
if os.environ.get("CONVENTIONS", "").strip():
|
||||||
user_blocks.append(f"# Repo CONVENTIONS.md\n{os.environ['CONVENTIONS']}\n")
|
user_blocks.append(f"# Repo CONVENTIONS.md\n{os.environ['CONVENTIONS']}\n")
|
||||||
with open(os.environ["DIFF_PATH"], encoding="utf-8", errors="replace") as _df:
|
user_blocks.append(f"# Diff\n```diff\n{os.environ['DIFF']}\n```\n")
|
||||||
_diff_text = _df.read()
|
|
||||||
user_blocks.append(f"# Diff\n```diff\n{_diff_text}\n```\n")
|
|
||||||
user_message = "\n\n".join(user_blocks)
|
user_message = "\n\n".join(user_blocks)
|
||||||
|
|
||||||
tools = [{
|
tools = [{
|
||||||
|
|||||||
94
.github/workflows/deploy.yml
vendored
94
.github/workflows/deploy.yml
vendored
@@ -28,10 +28,92 @@ jobs:
|
|||||||
-not -path './.github/*' \
|
-not -path './.github/*' \
|
||||||
-print0 | xargs -0 -n1 -P4 php -l > /dev/null
|
-print0 | xargs -0 -n1 -P4 php -l > /dev/null
|
||||||
|
|
||||||
deploy:
|
deploy-staging:
|
||||||
name: Deploy (shared pipeline)
|
name: Deploy to Staging
|
||||||
needs: validate
|
needs: validate
|
||||||
uses: peptiderepo/peptide-e2e/.github/workflows/deploy-app.yml@main
|
runs-on: ubuntu-latest
|
||||||
with:
|
environment: staging
|
||||||
target_path: wp-content/plugins/prautoblogger
|
steps:
|
||||||
secrets: inherit
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup SSH key
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
|
||||||
|
chmod 600 ~/.ssh/deploy_key
|
||||||
|
ssh-keyscan -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
|
||||||
|
- name: Deploy via rsync → staging
|
||||||
|
run: |
|
||||||
|
rsync -avz --delete \
|
||||||
|
--exclude '.git' --exclude '.github' \
|
||||||
|
--exclude 'tests' --exclude 'phpunit.xml.dist' \
|
||||||
|
--exclude 'composer.json' --exclude 'composer.lock' \
|
||||||
|
--exclude 'vendor' --exclude '.distignore' \
|
||||||
|
--exclude 'ARCHITECTURE.md' --exclude 'CONVENTIONS.md' \
|
||||||
|
-e "ssh -i ~/.ssh/deploy_key -p ${{ secrets.SSH_PORT }}" \
|
||||||
|
./ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:~/domains/peptiderepo.com/public_html/staging/wp-content/plugins/prautoblogger/
|
||||||
|
- name: Staging health check
|
||||||
|
run: |
|
||||||
|
sleep 5
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://staging.peptiderepo.com/ || echo "000")
|
||||||
|
echo "Staging responded: HTTP $STATUS"
|
||||||
|
[ "$STATUS" = "000" ] && echo "Warning: staging DNS may still be propagating" || true
|
||||||
|
- name: Cleanup
|
||||||
|
if: always()
|
||||||
|
run: rm -f ~/.ssh/deploy_key
|
||||||
|
|
||||||
|
smoke:
|
||||||
|
name: Smoke tests (staging)
|
||||||
|
needs: deploy-staging
|
||||||
|
continue-on-error: true
|
||||||
|
uses: peptiderepo/peptide-e2e/.github/workflows/smoke.yml@main
|
||||||
|
secrets:
|
||||||
|
STAGING_WP_ADMIN_USER: ${{ secrets.STAGING_WP_ADMIN_USER }}
|
||||||
|
STAGING_WP_ADMIN_PASSWORD: ${{ secrets.STAGING_WP_ADMIN_PASSWORD }}
|
||||||
|
|
||||||
|
deploy-production:
|
||||||
|
name: Deploy to Production
|
||||||
|
needs: [validate, deploy-staging]
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
environment: production
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- name: Setup SSH key
|
||||||
|
run: |
|
||||||
|
mkdir -p ~/.ssh
|
||||||
|
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/deploy_key
|
||||||
|
chmod 600 ~/.ssh/deploy_key
|
||||||
|
ssh-keyscan -p ${{ secrets.SSH_PORT }} ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts 2>/dev/null
|
||||||
|
- name: Deploy via rsync → production
|
||||||
|
run: |
|
||||||
|
rsync -avz --delete \
|
||||||
|
--exclude '.git' --exclude '.github' \
|
||||||
|
--exclude 'tests' --exclude 'phpunit.xml.dist' \
|
||||||
|
--exclude 'composer.json' --exclude 'composer.lock' \
|
||||||
|
--exclude 'vendor' --exclude '.distignore' \
|
||||||
|
--exclude 'ARCHITECTURE.md' --exclude 'CONVENTIONS.md' \
|
||||||
|
-e "ssh -i ~/.ssh/deploy_key -p ${{ secrets.SSH_PORT }}" \
|
||||||
|
./ ${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }}:~/domains/peptiderepo.com/public_html/wp-content/plugins/prautoblogger/
|
||||||
|
- name: Purge LiteSpeed Cache
|
||||||
|
run: |
|
||||||
|
ssh -i ~/.ssh/deploy_key -p ${{ secrets.SSH_PORT }} \
|
||||||
|
${{ secrets.SSH_USERNAME }}@${{ secrets.SSH_HOST }} \
|
||||||
|
"cd ~/domains/peptiderepo.com/public_html && \
|
||||||
|
wp litespeed-purge all 2>/dev/null || \
|
||||||
|
(find wp-content/litespeed/ -type f -delete 2>/dev/null; touch .lscache_purge 2>/dev/null) || true"
|
||||||
|
- name: Production health check
|
||||||
|
run: |
|
||||||
|
sleep 5
|
||||||
|
STATUS=$(curl -s -o /dev/null -w "%{http_code}" https://peptiderepo.com)
|
||||||
|
if [ "$STATUS" != "200" ] && [ "$STATUS" != "403" ]; then
|
||||||
|
echo "ERROR: Site returned unexpected HTTP $STATUS after deploy"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
echo "Production healthy (HTTP $STATUS)"
|
||||||
|
- name: Cleanup
|
||||||
|
if: always()
|
||||||
|
run: rm -f ~/.ssh/deploy_key
|
||||||
|
- name: Deploy summary
|
||||||
|
run: |
|
||||||
|
echo "## Deployment Complete" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- **Commit:** \`${GITHUB_SHA::7}\`" >> $GITHUB_STEP_SUMMARY
|
||||||
|
echo "- **Deployed to:** peptiderepo.com" >> $GITHUB_STEP_SUMMARY
|
||||||
|
|||||||
12
.github/workflows/main-push-audit.yml
vendored
12
.github/workflows/main-push-audit.yml
vendored
@@ -29,22 +29,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
script: |
|
script: |
|
||||||
const sha = context.sha;
|
const sha = context.sha;
|
||||||
// Squash-merge -> PR association is eventually-consistent; poll briefly
|
|
||||||
// before concluding this was a direct push (avoids false positives on merges).
|
|
||||||
async function findMergedPR() {
|
|
||||||
for (let attempt = 1; attempt <= 5; attempt++) {
|
|
||||||
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
const { data: prs } = await github.rest.repos.listPullRequestsAssociatedWithCommit({
|
||||||
owner: context.repo.owner,
|
owner: context.repo.owner,
|
||||||
repo: context.repo.repo,
|
repo: context.repo.repo,
|
||||||
commit_sha: sha,
|
commit_sha: sha,
|
||||||
});
|
});
|
||||||
const m = prs.find(p => p.merged_at);
|
const merged = prs.find(p => p.merged_at);
|
||||||
if (m) return m;
|
|
||||||
if (attempt < 5) await new Promise(r => setTimeout(r, 10000));
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
const merged = await findMergedPR();
|
|
||||||
if (merged) {
|
if (merged) {
|
||||||
core.info(`OK: commit ${sha.substring(0,7)} came from PR #${merged.number}`);
|
core.info(`OK: commit ${sha.substring(0,7)} came from PR #${merged.number}`);
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user