Skip to content

Commit

Permalink
add workflow_dispatch
Browse files Browse the repository at this point in the history
  • Loading branch information
jalbrekt85 committed Dec 3, 2024
1 parent 5327714 commit ba1ba1b
Showing 1 changed file with 23 additions and 13 deletions.
36 changes: 23 additions & 13 deletions .github/workflows/review_aura_gauge_votes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
pull_request:
paths:
- 'MaxiOps/vlaura_voting/**/input/*.csv'
workflow_dispatch:
inputs:
week-string:
description: "The week to review like YYYY-W##"
required: true

jobs:
review_votes:
Expand All @@ -22,21 +27,25 @@ jobs:
- name: Determine week-string
id: week-string
run: |
# Get the path of the changed CSV file
CSV_PATH=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep '/input/.*\.csv$' | head -n 1)
if [ -z "$CSV_PATH" ]; then
echo "No CSV file found in recent changes."
exit 1
fi
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
echo "week-string=${{ github.event.inputs.week-string }}" >> $GITHUB_OUTPUT
else
# Get the path of the changed CSV file
CSV_PATH=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep '/input/.*\.csv$' | head -n 1)
if [ -z "$CSV_PATH" ]; then
echo "No CSV file found in recent changes."
exit 1
fi
echo "CSV Path: $CSV_PATH"
YEAR=$(echo $CSV_PATH | cut -d'/' -f3)
WEEK=$(echo $CSV_PATH | cut -d'/' -f4)
WEEK_STRING="${YEAR}-${WEEK}"
echo "CSV Path: $CSV_PATH"
YEAR=$(echo $CSV_PATH | cut -d'/' -f3)
WEEK=$(echo $CSV_PATH | cut -d'/' -f4)
WEEK_STRING="${YEAR}-${WEEK}"
echo "week-string=$WEEK_STRING" >> $GITHUB_OUTPUT
echo "week-string=$WEEK_STRING" >> $GITHUB_OUTPUT
fi
- name: Review vLAURA Votes
run: |
Expand All @@ -47,6 +56,7 @@ jobs:
python3 $RUN_DIR/review_votes.py --week-string "${{ steps.week-string.outputs.week-string }}"
- name: Comment PR
if: github.event_name == 'pull_request'
uses: actions/github-script@v7
with:
github-token: ${{secrets.GITHUB_TOKEN}}
Expand Down

0 comments on commit ba1ba1b

Please sign in to comment.