Skip to content

Commit e3a8566

Browse files
Copilotdcasati
andcommitted
Add interactive helper script and update documentation for posting remediation comment
Co-authored-by: dcasati <3240777+dcasati@users.noreply.github.com>
1 parent d573c77 commit e3a8566

File tree

2 files changed

+141
-5
lines changed

2 files changed

+141
-5
lines changed

β€ŽAct-3/remediation/README.mdβ€Ž

Lines changed: 58 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,35 @@ This directory contains root cause analysis and remediation recommendations for
44

55
## How to Post Remediation Comments to GitHub Issues
66

7-
### Option 1: Using GitHub CLI (Recommended)
7+
### Option 1: Using the Helper Script (Easiest)
88

99
```bash
10-
# Authenticate with GitHub
10+
# From the repository root
11+
bash Act-3/remediation/post-comment.sh
12+
```
13+
14+
This interactive script will:
15+
- Check if GitHub CLI is installed and authenticated
16+
- Confirm before posting
17+
- Post the comment to issue #12
18+
- Show you the URL to view the comment
19+
20+
### Option 2: Using GitHub CLI Directly
21+
22+
```bash
23+
# Authenticate with GitHub (if not already)
24+
gh auth login
25+
26+
# Post the comment
27+
gh issue comment 12 \
28+
--repo DevExpGbb/agentic-platform-engineering \
29+
--body-file Act-3/remediation/issue-12-argocd-deployment-failure.md
30+
```
31+
32+
### Option 2: Using GitHub CLI Directly
33+
34+
```bash
35+
# Authenticate with GitHub (if not already)
1136
gh auth login
1237

1338
# Post the comment
@@ -16,7 +41,19 @@ gh issue comment 12 \
1641
--body-file Act-3/remediation/issue-12-argocd-deployment-failure.md
1742
```
1843

19-
### Option 2: Using GitHub Actions Workflow
44+
### Option 3: Using GitHub Actions Workflow
45+
46+
A workflow has been created at `.github/workflows/post-issue-comment.yml` that can be manually triggered:
47+
48+
1. Go to Actions tab in GitHub
49+
2. Select "Post Issue Comment" workflow
50+
3. Click "Run workflow"
51+
4. Enter:
52+
- Issue number: `12`
53+
- Comment file: `Act-3/remediation/issue-12-argocd-deployment-failure.md`
54+
5. Click "Run workflow"
55+
56+
### Option 3: Using GitHub Actions Workflow
2057

2158
A workflow has been created at `.github/workflows/post-issue-comment.yml` that can be manually triggered:
2259

@@ -28,7 +65,22 @@ A workflow has been created at `.github/workflows/post-issue-comment.yml` that c
2865
- Comment file: `Act-3/remediation/issue-12-argocd-deployment-failure.md`
2966
5. Click "Run workflow"
3067

31-
### Option 3: Using GitHub API directly
68+
### Option 4: Using GitHub API directly
69+
70+
```bash
71+
# Set your GitHub token
72+
export GITHUB_TOKEN="your_token_here"
73+
74+
# Post the comment
75+
curl -X POST \
76+
-H "Authorization: Bearer $GITHUB_TOKEN" \
77+
-H "Accept: application/vnd.github+json" \
78+
-H "X-GitHub-Api-Version: 2022-11-28" \
79+
https://api.github.com/repos/DevExpGbb/agentic-platform-engineering/issues/12/comments \
80+
-d @<(jq -Rs '{"body": .}' < Act-3/remediation/issue-12-argocd-deployment-failure.md)
81+
```
82+
83+
### Option 4: Using GitHub API directly
3284

3385
```bash
3486
# Set your GitHub token
@@ -43,7 +95,7 @@ curl -X POST \
4395
-d @<(jq -Rs '{"body": .}' < Act-3/remediation/issue-12-argocd-deployment-failure.md)
4496
```
4597

46-
### Option 4: Manual Copy-Paste
98+
### Option 5: Manual Copy-Paste
4799

48100
1. Open the file: `Act-3/remediation/issue-12-argocd-deployment-failure.md`
49101
2. Copy the entire contents
@@ -54,4 +106,5 @@ curl -X POST \
54106
## Files in This Directory
55107

56108
- `issue-12-argocd-deployment-failure.md` - Comprehensive root cause analysis and remediation recommendations for the `2-broken-apps` ArgoCD deployment failure
109+
- `post-comment.sh` - Interactive helper script to post the comment (requires gh CLI)
57110
- `README.md` - This file, with instructions on how to post the remediation comments
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
#!/bin/bash
2+
3+
# Quick Post Comment Script
4+
# This script posts the remediation comment to GitHub issue #12
5+
#
6+
# Prerequisites:
7+
# - GitHub CLI (gh) installed
8+
# - Authenticated with: gh auth login
9+
#
10+
# Usage:
11+
# cd /path/to/repo
12+
# bash Act-3/remediation/post-comment.sh
13+
14+
set -e
15+
16+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
17+
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
18+
COMMENT_FILE="$SCRIPT_DIR/issue-12-argocd-deployment-failure.md"
19+
20+
ISSUE_NUMBER=12
21+
REPO="DevExpGbb/agentic-platform-engineering"
22+
23+
echo "═══════════════════════════════════════════════════════════"
24+
echo " ArgoCD Deployment Failure - Post Remediation Comment"
25+
echo "═══════════════════════════════════════════════════════════"
26+
echo ""
27+
28+
# Check if gh is installed
29+
if ! command -v gh &> /dev/null; then
30+
echo "❌ Error: GitHub CLI (gh) is not installed"
31+
echo ""
32+
echo "Install it from: https://cli.github.com/"
33+
echo ""
34+
echo "Or use an alternative method from README.md"
35+
exit 1
36+
fi
37+
38+
# Check if authenticated
39+
if ! gh auth status &> /dev/null; then
40+
echo "❌ Error: Not authenticated with GitHub CLI"
41+
echo ""
42+
echo "Please authenticate with: gh auth login"
43+
echo ""
44+
exit 1
45+
fi
46+
47+
# Check if comment file exists
48+
if [ ! -f "$COMMENT_FILE" ]; then
49+
echo "❌ Error: Comment file not found at: $COMMENT_FILE"
50+
exit 1
51+
fi
52+
53+
echo "βœ“ GitHub CLI installed and authenticated"
54+
echo "βœ“ Comment file found: $(basename $COMMENT_FILE)"
55+
echo ""
56+
echo "Repository: $REPO"
57+
echo "Issue: #$ISSUE_NUMBER"
58+
echo ""
59+
echo "───────────────────────────────────────────────────────────"
60+
read -p "Post comment to issue #$ISSUE_NUMBER? (y/N): " -n 1 -r
61+
echo ""
62+
echo "───────────────────────────────────────────────────────────"
63+
64+
if [[ ! $REPLY =~ ^[Yy]$ ]]; then
65+
echo ""
66+
echo "❌ Cancelled by user"
67+
exit 0
68+
fi
69+
70+
echo ""
71+
echo "Posting comment..."
72+
echo ""
73+
74+
# Post the comment
75+
gh issue comment "$ISSUE_NUMBER" \
76+
--repo "$REPO" \
77+
--body-file "$COMMENT_FILE"
78+
79+
echo ""
80+
echo "βœ… Comment posted successfully!"
81+
echo ""
82+
echo "View at: https://github.com/$REPO/issues/$ISSUE_NUMBER"
83+
echo ""

0 commit comments

Comments
Β (0)