Fix environment variable access in calculate.py #38
Workflow file for this run
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: Calculate Score | |
on: push | |
jobs: | |
calculate-score: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get push time | |
id: push-time | |
run: echo "time=$(date -u +'%H:%M:%S' -d '+9 hours')" >> $GITHUB_OUTPUT | |
- name: Discord Push Notification | |
uses: appleboy/discord-action@master | |
with: | |
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} | |
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} | |
message: "Push by @${{ github.actor }} at ${{ steps.push-time.outputs.time }}" | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: "zulu" | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Run all local screenshot tests (Roborazzi) | |
run: ./gradlew recordRoborazziDebug | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
cache: 'pip' | |
- name: Install dependencies | |
run: | | |
pip install -r score-calculation/requirements.txt | |
- run: | | |
git clone https://github.com/misaelnieto/vercel-storage.git | |
cd vercel-storage | |
pip install -e . | |
- name: Calculate score | |
id: score | |
run: echo "result=$(python score-calculation/calculate.py)" >> $GITHUB_OUTPUT | |
env: | |
BLOB_READ_WRITE_TOKEN': ${{ secrets.BLOB_READ_WRITE_TOKEN }} | |
- name: Output score | |
run: | | |
echo "Score: ${{ steps.score.outputs.result }}" | |
- name: Discord Score Notification | |
uses: appleboy/discord-action@master | |
with: | |
webhook_id: ${{ secrets.DISCORD_WEBHOOK_ID }} | |
webhook_token: ${{ secrets.DISCORD_WEBHOOK_TOKEN }} | |
message: "Result: ${{ steps.score.outputs.result }} by @${{ github.actor }} at ${{ steps.push-time.outputs.time }}" | |
file: "question/img/except.png,app/build/outputs/roborazzi/com.github.nidroid.uiperfectcopycontesttest.ExampleUnitTest.yourAnswerTest.png" | |
- name: Send screenshot to Blob | |
run: | | |
curl -v -s -X POST -H "Authorization: Bearer ${{ secrets.BLOB_READ_WRITE_TOKEN }}" -H "access: public" -H "Content-Type: application/json" -H "x-content-type: image/png" -H "x-api-version: 7" -F "file=@app/build/outputs/roborazzi/com.github.nidroid.uiperfectcopycontesttest.ExampleUnitTest.yourAnswerTest.png" ${{ secrets.API_URL }}/api/v1/blob/${{ github.actor }}/${{ github.run_number }}.png | |
- name: Upload screenshot | |
uses: actions/upload-artifact@v4 | |
with: | |
name: screenshot_result | |
path: app/build/outputs/roborazzi |