Skip to content

Commit

Permalink
Fix leaderboard action
Browse files Browse the repository at this point in the history
  • Loading branch information
hetulvp committed Apr 20, 2024
1 parent 2e4ec9a commit e50baf6
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,20 +1,31 @@
name: Check star for a prompt challenge submission
name: Checks for prompt eng challenge submission.

on:
pull_request:
types: [opened, reopened, synchronize]

jobs:
is-stargazer:
has-valid-submission:
runs-on: ubuntu-latest
steps:

- uses: dorny/[email protected]
- name: Check if there are any changes in submissions dir
uses: dorny/[email protected]
id: changes
with:
filters: |
src:
- 'session_2/challenge/submissions/**'
list-files: "shell"

- name: Print changed files
run: |
echo '${{ toJSON(steps.changes.outputs) }}'
- if: ${{ (steps.changes.outputs.src_count > 1) }}
uses: actions/github-script@v7
with:
script: core.setFailed('More than one submissions are not allowed at once.')

- uses: gacts/[email protected]
id: check-star
Expand Down
25 changes: 4 additions & 21 deletions .github/workflows/update_leaderboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- if: ${{ (steps.changes.outputs.src_count > 1) }}
uses: actions/github-script@v7
with:
script: core.setFailed('More than one submissions are not allowed at once.')
script: core.setFailed('More than one submissions are not allowed at once.')

# Update leaderboard only if single file is changed in submission dir
- if: ${{ (steps.changes.outputs.src == 'true') && (steps.changes.outputs.src_count == 1) }}
Expand Down Expand Up @@ -58,28 +58,11 @@ jobs:
filename_without_extension="${filename%.*}" # Remove extension
python -m scripts.leaderboard --github_user="${{ github.actor }}" --prompt="$filename_without_extension"
- name: Commit changes
- if: ${{ (steps.changes.outputs.src == 'true') && (steps.changes.outputs.src_count == 1) }}
name: Commit changes
uses: EndBug/add-and-commit@v9
with:
author_name: GitHub Actions
author_email: [email protected]
message: 'Updated leader board'
add: 'session_2/challenge/leaderboard.md'

# # Commit the updated leaderboard
# - if: ${{ (steps.changes.outputs.src == 'true') && (steps.changes.outputs.src_count == 1) }}
# name: Commit updated leaderboard
# id: commit-leaderboard
# run: |
# git config --global user.name "GitHub Actions"
# git config --global user.email "[email protected]"
# git add session_2/challenge/leaderboard.md
# git commit -m "Update leaderboard"
# git push -f origin HEAD:${{ github.ref }}


# # Print the commit SHA for reference
# - if: ${{ (steps.changes.outputs.src == 'true') && (steps.changes.outputs.src_count == 1) }}
# name: Print Commit SHA
# run: |
# echo "Commit SHA: ${{ steps.commit-leaderboard.outputs.commit_sha }}"
add: 'session_2/challenge/leaderboard.md'
2 changes: 1 addition & 1 deletion session_2/challenge/submissions/baseline.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def build_prompt(self, job_description: str) -> str:
Say "YES" if the given job description is suitable for
a freshers other wise say "NO".
{job_description}.
{job_description}
"""
return prompt.strip()
Expand Down

0 comments on commit e50baf6

Please sign in to comment.