Amazon SES (Hackathon Demo) #34
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: v2 App Review | |
on: [pull_request] | |
jobs: | |
v2-app-review: | |
name: "V2 App Review" | |
runs-on: "ubuntu-latest" | |
env: | |
SUMO_APPS_V2_REPO_PATH: ${{ github.workspace }} | |
TARGET_BRANCH: "origin/${{ github.event.pull_request.base.ref }}" | |
SOURCE_BRANCH: "origin/${{ github.event.pull_request.head.ref }}" | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python 3.12 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.12 | |
- name: Install dependencies | |
run: | | |
python3 -m pip install -U pip wheel setuptools yq | |
- name: "Install sumoappsuite tool" | |
run: | | |
pip3 install $GITHUB_WORKSPACE/scripts/sumologic_appdevutils*.whl | |
- name: Set up AWS CLI | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: "us-west-2" | |
- name: "Generate SCR File" | |
run: | | |
sumoappsuite generate-scr-file-v2-app && cat scr_app_list.yaml | |
- name: "Set relativeFolderPath" | |
id: set_relative_folder_path | |
run: | | |
echo "app_path=$(cat scr_app_list.yaml | yq '.apps[0].relativeFolderPath')" >> "$GITHUB_ENV" | |
- name: "Run Sumo Logic App Review tool" | |
run: | | |
export app_folder_path=$(echo "${SUMO_APPS_V2_REPO_PATH}/src/${app_path}" | sed "s/\"//g") | |
sumoappsuite review-v2-app -f "$app_folder_path" | |
echo "excel_file_path=$app_folder_path/appreview*.xlsx" >> "$GITHUB_ENV" | |
- name: Upload Excel Sheet as PR Comment | |
id: upload_artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: excel-sheet | |
path: "${{ env.excel_file_path}}" | |
if-no-files-found: error | |
- name: Comment on PR with Artifact URL | |
run: | | |
PR_NUMBER=$(echo $GITHUB_REF | awk -F'/' '{print $3}') | |
ARTIFACT_URL="${{ steps.upload_artifact.outputs.artifact-url }}" | |
APP_NAME=$(cat scr_app_list.yaml | yq '.apps[0].name') | |
curl -X POST -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" -d "{\"body\": \"Reviewed AppName: ${APP_NAME} Download the review feedback [sheet]($ARTIFACT_URL)\"}" "https://api.github.com/repos/${{ github.repository }}/issues/$PR_NUMBER/comments" |