Skip to content

Commit

Permalink
feat: improve workflow step summaries and environment variable handling
Browse files Browse the repository at this point in the history
- Added detailed step summaries for better clarity in the workflow summary
- Updated environment variable handling for DESTINATION_REPOSITORY_USERNAME
- Ensured proper formatting and consistency in step summary messages
  • Loading branch information
maxisoft committed Jul 27, 2024
1 parent bd61113 commit 045581f
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions .github/workflows/doit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,24 @@ jobs:
- name: Run app
if: ${{ github.actor == github.repository_owner }}
run: |
echo "kaggle kernels download process" > $GITHUB_STEP_SUMMARY
echo "- kaggle kernels download process" >> $GITHUB_STEP_SUMMARY
python main.py
echo "kaggle kernels downloaded" > $GITHUB_STEP_SUMMARY
echo "- kaggle kernels downloaded" > $GITHUB_STEP_SUMMARY
- name: ReZip kernels
if: ${{ github.actor == github.repository_owner }}
run: |
if [ -z "${{ secrets.ARCHIVE_PASSWORD }}" ]; then
echo "ARCHIVE_PASSWORD secret is not set"
echo "ARCHIVE_PASSWORD secret is not set" >> $GITHUB_STEP_SUMMARY
echo "- ARCHIVE_PASSWORD secret is not set" >> $GITHUB_STEP_SUMMARY
exit 0
fi
mkdir -p tmp
7z x kernels.zip -otmp
echo "kernels.7z creation" > $GITHUB_STEP_SUMMARY
echo "- kernels.7z creation" > $GITHUB_STEP_SUMMARY
7z a -t7z -mx=9 -p"${{ secrets.ARCHIVE_PASSWORD }}" kernels.7z tmp/*
echo "archive_created=true" >> $GITHUB_ENV
echo "kernels.7z has been created" > $GITHUB_STEP_SUMMARY
echo "- kernels.7z has been created" > $GITHUB_STEP_SUMMARY
rm -rf tmp || :
- name: Upload Archive Artifact
Expand All @@ -104,7 +104,7 @@ jobs:
- if: ${{ github.actor == github.repository_owner }}
run: |
if [ -z "${{ secrets.SSH_DEPLOY_KEY }}" ]; then
echo "SSH_DEPLOY_KEY secret is not set" >> $GITHUB_STEP_SUMMARY
echo "- SSH_DEPLOY_KEY secret is not set" >> $GITHUB_STEP_SUMMARY
exit 0
fi
Expand All @@ -117,29 +117,40 @@ jobs:
fi
fi
if [ -z "${{ env.DESTINATION_REPOSITORY_USERNAME }}" ]; then
if [ -z "${{ secrets.DESTINATION_REPOSITORY_USERNAME }}" ]; then
export DESTINATION_REPOSITORY_USERNAME="${{ github.actor }}"
echo "DESTINATION_REPOSITORY_USERNAME set from github.actor"
else
export DESTINATION_REPOSITORY_USERNAME="${{ secrets.DESTINATION_REPOSITORY_USERNAME }}"
echo "DESTINATION_REPOSITORY_USERNAME set from secrets"
fi
fi
if [ -z "$DESTINATION_REPOSITORY_NAME" ]; then
echo "DESTINATION_REPOSITORY_NAME is not set"
echo "DESTINATION_REPOSITORY_NAME is not set" >> $GITHUB_STEP_SUMMARY
echo "- DESTINATION_REPOSITORY_NAME is not set" >> $GITHUB_STEP_SUMMARY
exit 0
fi
echo "DESTINATION_REPOSITORY_NAME=$DESTINATION_REPOSITORY_NAME" >> $GITHUB_ENV
echo "DESTINATION_REPOSITORY_USERNAME=$DESTINATION_REPOSITORY_USERNAME" >> $GITHUB_ENV
rm -rf tmp || :
mkdir -p tmp
echo "Extract archive" > $GITHUB_STEP_SUMMARY
echo "- Extract archive" >> $GITHUB_STEP_SUMMARY
7z x kernels.zip -otmp
echo "DEPLOY_TO_REPOSITORY=true" >> $GITHUB_ENV
echo "DEPLOY_TO_REPOSITORY prepared" >> $GITHUB_STEP_SUMMARY
echo "- DEPLOY_TO_REPOSITORY prepared" >> $GITHUB_STEP_SUMMARY
- name: Push kernels directory to another repository
uses: cpina/[email protected]
if: ${{ env.DEPLOY_TO_REPOSITORY == 'true' && github.actor == github.repository_owner }}
with:
source-directory: tmp
destination-github-username: ${{ env.DESTINATION_REPOSITORY_USERNAME || github.actor }}
destination-github-username: ${{ env.DESTINATION_REPOSITORY_USERNAME }}
destination-repository-name: ${{ env.DESTINATION_REPOSITORY_NAME }}
user-name: ${{ github.actor }}
user-email: ${{ github.actor }}@users.noreply.github.com
Expand Down

0 comments on commit 045581f

Please sign in to comment.