Skip to content

Added baseline submission #2

Added baseline submission

Added baseline submission #2

name: Check star for a prompt challenge submission
on:
pull_request:
types: [opened, reopened, synchronize]
jobs:
check_star_for_submission:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Check for changes in submissions directory
id: check_submissions_changes
run: |
if git diff --name-only ${{ github.base_ref }} ${{ github.head_ref }} | grep '^session_2/challenge/submissions/'; then
echo "::set-output name=changes_made::true"
else
echo "::set-output name=changes_made::false"
fi
- name: Check if user has starred the repo
id: check_stars
if: steps.check_submissions_changes.outputs.changes_made == 'true'
run: |
user=$(jq -r .sender.login "$GITHUB_EVENT_PATH")
repo=$(jq -r .repository.full_name "$GITHUB_EVENT_PATH")
if ! curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" "https://api.github.com/user/starred/$repo" | jq -e '.[] | select(.owner.login == "$user")'; then
echo "::error::User $user must star the repository to submit a pull request."
exit 1
fi
- name: Check if all checks passed
run: echo "All checks passed."