diff --git a/.github/workflows/check_star_for_challenge_submission.yaml b/.github/workflows/checks_for_submission.yaml similarity index 51% rename from .github/workflows/check_star_for_challenge_submission.yaml rename to .github/workflows/checks_for_submission.yaml index d58f8c5..45b1e13 100644 --- a/.github/workflows/check_star_for_challenge_submission.yaml +++ b/.github/workflows/checks_for_submission.yaml @@ -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/paths-filter@v3.0.2 + - name: Check if there are any changes in submissions dir + uses: dorny/paths-filter@v3.0.2 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/is-stargazer@v1.1.0 id: check-star diff --git a/.github/workflows/update_leaderboard.yaml b/.github/workflows/update_leaderboard.yaml index 59c8fb4..19904ef 100644 --- a/.github/workflows/update_leaderboard.yaml +++ b/.github/workflows/update_leaderboard.yaml @@ -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/paths-filter@v3.0.2 id: changes @@ -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 @@ -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: actions@github.com 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 "actions@github.com" - # 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 }}" \ No newline at end of file + add: 'session_2/challenge/leaderboard.md' \ No newline at end of file diff --git a/session_2/challenge/submissions/baseline.py b/session_2/challenge/submissions/baseline.py index c8f6b3e..cad9630 100644 --- a/session_2/challenge/submissions/baseline.py +++ b/session_2/challenge/submissions/baseline.py @@ -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()