-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22 from sahil280114/main
add github action for datagen
- Loading branch information
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: Build dataset | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
branches: | ||
- main | ||
|
||
jobs: | ||
notify: | ||
if: github.event.pull_request.merged == true | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.x' | ||
|
||
- name: Get list of added files | ||
id: get_added_files | ||
run: | | ||
# Directory to check for added files | ||
DIRECTORY_TO_CHECK="tasks" | ||
# Get list of added files in the specified directory | ||
ADDED_FILES=$(git diff --name-status ${{ github.event.before }} ${{ github.sha }} | awk '/^A/ {print $2}' | grep "^$DIRECTORY_TO_CHECK") | ||
# Export the list as an environment variable | ||
echo "ADDED_FILES=$ADDED_FILES" >> $GITHUB_ENV | ||
# Print the files for debugging | ||
echo "Added files:" | ||
echo "$ADDED_FILES" | ||
# Convert space-separated string to JSON array | ||
JSON_ARRAY=$(echo $ADDED_FILES | jq -R -s -c 'split(" ")') | ||
# Export the JSON array as an environment variable | ||
echo "ADDED_FILES_JSON=$JSON_ARRAY" >> $GITHUB_ENV | ||
# Print the JSON array for debugging | ||
echo "Added files JSON array:" | ||
echo "$JSON_ARRAY" | ||
- name: Notify API | ||
if: steps.get_added_files.outputs.added_files != '' | ||
run: | | ||
# Define the API endpoint and token | ||
API_ENDPOINT="https://open-reasoning-tasks-action-production.up.railway.app/process-files" | ||
# Send the list of added files to the API endpoint | ||
curl -X POST $API_ENDPOINT \ | ||
-H "Content-Type: application/json" \ | ||
-H "Authorization: Bearer ${{ secrets.GLAIVE_API_AUTH_TOKEN }}" \ | ||
-d "{\"added_files\": \"$ADDED_FILES_JSON\"}" |