Skip to content

Bump sha.js from 2.4.11 to 2.4.12 in /SmartMedia/SmartMediaClient #74

Bump sha.js from 2.4.11 to 2.4.12 in /SmartMedia/SmartMediaClient

Bump sha.js from 2.4.11 to 2.4.12 in /SmartMedia/SmartMediaClient #74

Workflow file for this run

name: GitCompare
on:
issue_comment:
types: [created]
jobs:
parse-comment:
if: github.event.issue.pull_request && startsWith(github.event.comment.body, '.ch_gitcompare')
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
outputs:
good_build: ${{ steps.parse.outputs.good_build }}
bad_build: ${{ steps.parse.outputs.bad_build }}
steps:
- name: Parse comment
id: parse
env:
COMMENT_BODY: ${{ github.event.comment.body }}
run: |
echo "Comment body: $COMMENT_BODY"
# Extract good_build and bad_build from the command
# Remove the .ch_gitcompare command
COMMENT=${COMMENT_BODY#.ch_gitcompare}
# Parse --good_build argument (capture everything until --bad_build)
if [[ $COMMENT =~ --good_build[[:space:]]+(.*)[[:space:]]+--bad_build[[:space:]]+(.*) ]]; then
GOOD_BUILD="${BASH_REMATCH[1]}"
BAD_BUILD="${BASH_REMATCH[2]}"
else
echo "Error: Invalid format. Please use: .ch_gitcompare --good_build <good_build> --bad_build <bad_build>"
exit 1
fi
# Clean up whitespace and remove outer quotes
GOOD_BUILD=$(echo "$GOOD_BUILD" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | sed 's/^"//;s/"$//')
BAD_BUILD=$(echo "$BAD_BUILD" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//' | sed 's/^"//;s/"$//')
echo "Good build: '$GOOD_BUILD'"
echo "Bad build: '$BAD_BUILD'"
# Validate builds
if [ -z "$GOOD_BUILD" ] || [ -z "$BAD_BUILD" ]; then
echo "Error: Invalid format. Please use: .ch_gitcompare --good_build <good_build> --bad_build <bad_build>"
exit 1
fi
# Set outputs
{
echo "good_build<<EOF"
echo "$GOOD_BUILD"
echo "EOF"
} >> $GITHUB_OUTPUT
{
echo "bad_build<<EOF"
echo "$BAD_BUILD"
echo "EOF"
} >> $GITHUB_OUTPUT
compare:
needs: parse-comment
runs-on: ubuntu-latest
permissions:
contents: read
issues: write
pull-requests: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Run CommitHunter
id: run_commit_hunter
env:
GOOD_BUILD: ${{ needs.parse-comment.outputs.good_build }}
BAD_BUILD: ${{ needs.parse-comment.outputs.bad_build }}
run: |
cd CommitHunter
echo "Running commit_hunter.sh with:"
echo "Good build: $GOOD_BUILD"
echo "Bad build: $BAD_BUILD"
bash commit_hunter.sh "$GOOD_BUILD" "$BAD_BUILD" > output.txt
echo "CommitHunter output:"
cat output.txt
- name: Parse URLs from output
id: parse_urls
run: |
if [ -f "./CommitHunter/output.txt" ]; then
echo "Found output file, parsing URLs..."
cat ./CommitHunter/output.txt
url_openj9=$(grep "OpenJ9:" ./CommitHunter/output.txt | awk '{print $2}')
url_omr=$(grep "OMR:" ./CommitHunter/output.txt | awk '{print $2}')
url_jcl=$(grep "JCL:" ./CommitHunter/output.txt | awk '{print $2}')
echo "Parsed URLs:"
echo "OpenJ9: $url_openj9"
echo "OMR: $url_omr"
echo "JCL: $url_jcl"
echo "url_openj9=$url_openj9" >> $GITHUB_OUTPUT
echo "url_omr=$url_omr" >> $GITHUB_OUTPUT
echo "url_jcl=$url_jcl" >> $GITHUB_OUTPUT
else
echo "Error: output.txt not found in CommitHunter directory"
ls -la ./CommitHunter/
exit 1
fi
- name: Prepare comment
run: |
echo "## 🔍 GitCompare Results" > comment.md
echo "" >> comment.md
echo "### OpenJ9 Changes" >> comment.md
echo "${{ steps.parse_urls.outputs.url_openj9 }}" >> comment.md
echo "" >> comment.md
echo "### OMR Changes" >> comment.md
echo "${{ steps.parse_urls.outputs.url_omr }}" >> comment.md
echo "" >> comment.md
echo "### JCL Changes" >> comment.md
echo "${{ steps.parse_urls.outputs.url_jcl }}" >> comment.md
echo "" >> comment.md
echo "> 💡 **Note:** These links show the differences between the specified builds."
echo "Prepared comment:"
cat comment.md
- name: Comment on PR
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_REPOSITORY: ${{ github.repository }}
ISSUE_NUMBER: ${{ github.event.issue.number }}
run: |
pip install PyGithub
python3 <<EOF
import os
import sys
from github import Github
try:
with open("comment.md", "r", encoding="utf-8") as f:
comment_body = f.read()
token = os.environ["GITHUB_TOKEN"]
repo_name = os.environ["GITHUB_REPOSITORY"]
issue_number = int(os.environ["ISSUE_NUMBER"])
g = Github(token)
repo = g.get_repo(repo_name)
issue = repo.get_issue(number=issue_number)
comment = issue.create_comment(comment_body)
print(f"✅ Comment created successfully: {comment.html_url}")
except Exception as e:
print(f"❌ Error creating comment: {e}")
print(f"Error type: {type(e).__name__}")
sys.exit(1)
EOF