Week_02 장윤영 #95
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
name: Update Submission Status | ||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
jobs: | ||
update_status: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
- name: Set up Python | ||
uses: actions/setup-python@v2 | ||
with: | ||
python-version: '3.x' | ||
- name: Install dependencies | ||
run: pip install requests PyGithub | ||
- name: Extract information from PR title | ||
id: extract_info | ||
run: | | ||
echo "PR_TITLE=${{ github.event.pull_request.title }}" >> $GITHUB_ENV | ||
echo "PR_CREATED_AT=${{ github.event.pull_request.created_at }}" >> $GITHUB_ENV | ||
echo "PR Title: ${{ github.event.pull_request.title }}" | ||
echo "PR Created At: ${{ github.event.pull_request.created_at }}" | ||
if [[ "${{ github.event.pull_request.title }}" =~ ^Week_([0-9]+)\ (.*)$ ]]; then | ||
echo "WEEK=${BASH_REMATCH[1]}" >> $GITHUB_ENV | ||
echo "PARTICIPANT=${BASH_REMATCH[2]}" >> $GITHUB_ENV | ||
echo "Extracted WEEK: ${BASH_REMATCH[1]}" | ||
echo "Extracted PARTICIPANT: ${BASH_REMATCH[2]}" | ||
else | ||
echo "Invalid PR title format" | ||
exit 1 | ||
fi | ||
- name: Check GITHUB_TOKEN | ||
run: echo "MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }}" | ||
- name: Run update script | ||
run: python update_submission_status.py | ||
env: | ||
MY_GITHUB_TOKEN: ${{ secrets.MY_GITHUB_TOKEN }} | ||
GITHUB_HEAD_REF: ${{ env.PR_TITLE }} | ||
GITHUB_EVENT_PR_CREATED_AT: ${{ env.PR_CREATED_AT }} | ||
WEEK: ${{ env.WEEK }} | ||
PARTICIPANT: ${{ env.PARTICIPANT }} |