Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix leaderboard action #9

Merged
merged 1 commit into from
Apr 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
31 changes: 8 additions & 23 deletions .github/workflows/update_leaderboard.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
leaderboard_evaluation:
runs-on: ubuntu-latest
steps:
# Check changes in the source branch of the PR
- name: Check if there are any changes in submissions dir
uses: dorny/[email protected]
id: changes
Expand All @@ -27,15 +28,16 @@ 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) }}
name: Checkout code
uses: actions/checkout@v4
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
ref: ${{ github.event.pull_request.head.ref }}
# Here we checkout the target branch of the PR
repository: ${{ github.event.pull_request.base.repo.full_name }}
ref: ${{ github.event.pull_request.base.ref }}

- if: ${{ (steps.changes.outputs.src == 'true') && (steps.changes.outputs.src_count == 1) }}
name: Install Python
Expand All @@ -58,28 +60,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