Skip to content

Commit

Permalink
Merge pull request #81 from donghoony/patch-1
Browse files Browse the repository at this point in the history
喝 !!!
  • Loading branch information
hw0603 authored Jul 18, 2024
2 parents d5c0ee5 + 6d3a446 commit 568013d
Showing 1 changed file with 52 additions and 0 deletions.
52 changes: 52 additions & 0 deletions .github/workflows/gal-create-directories.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Create Galgorithm directories

on:
issues:
types: [opened]

jobs:
GAL:
runs-on: ubuntu-latest
if: "startsWith(github.event.issue.title, '[GAL]')"

permissions:
write-all

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Validate issue format, push to github
run: |
ISSUE_TITLE="${{ github.event.issue.title }}"
id=("burningfalls" "donghoony" "hjk0761" "hw0603" "hyxrxn" "jminkkk" "robinjoon" "slimsha2dy")
if [[ ! "$ISSUE_TITLE" =~ ^\[GAL\]\ ([a-zA-Z0-9_-]+)\ ([0-9]+[,[0-9]+]*)$ ]]; then
echo "Issue title format is incorrect."
exit 1
fi
DIRNAME="${BASH_REMATCH[1]}"
NUMBERS="${BASH_REMATCH[2]}"
IFS=',' read -ra NUM_ARRAY <<< "$NUMBERS"
for NUM in "${NUM_ARRAY[@]}"; do
mkdir -p "${DIRNAME}/${NUM}"
for GID in "${id[@]}"; do
mkdir -p "${DIRNAME}/${NUM}/${GID}"
echo -e "# Info\n\n## 💡 풀이 방법 요약\n\n## 👀 실패 이유\n\n## 🙂 마무리" > "${DIRNAME}/${NUM}/${GID}/README.md"
done
done
git config --local user.email "[email protected]"
git config --local user.name "GitHub Actions"
git add .
git commit -m "Create directories and files for GAL issue: ${{ github.event.issue.number }}"
git push
- name: Close issue after pushing
uses: peter-evans/close-issue@v3
with:
comment: |
Created directories, closing issue.

0 comments on commit 568013d

Please sign in to comment.