diff --git a/.github/workflows/configlet-sync.yml b/.github/workflows/configlet-sync.yml new file mode 100644 index 00000000..2bf33f8a --- /dev/null +++ b/.github/workflows/configlet-sync.yml @@ -0,0 +1,18 @@ +name: Configlet Sync + +on: + workflow_dispatch: + schedule: + - cron: 0 0 4 * * # 4th day of each month + +permissions: + contents: write + pull-requests: write + issues: write + +jobs: + configlet-sync: + uses: exercism/github-actions/.github/workflows/configlet-sync.yml@main + with: + sync_docs: true + sync_tests: true diff --git a/bin/auto-sync.sh b/bin/auto-sync.sh index f7d1fc1f..a8b102c9 100755 --- a/bin/auto-sync.sh +++ b/bin/auto-sync.sh @@ -1,62 +1,9 @@ #!/usr/bin/env bash -scriptDirectory="$( dirname "$0" )" if [[ "$#" != 0 ]]; then forwardedParameters=( "$@" ) else forwardedParameters=( -o -u -y --docs --filepaths --metadata --tests include ) fi -exitWithFailure() { - echo "$1" - exit 1 -} - -isPracticeExercise() { - [ -d "exercises/practice/$1" ] -} - -reportUnknownExercise() { - echo "Unknown practice exercise: $1" -} - -isNoPracticeExercise() { - isPracticeExercise "$1" || { - reportUnknownExercise "$1" - return 0 - } - return 1 -} - -reportRepeatedExercise() { - echo "Repeated exercise slug: $1" -} - -syncPracticeExercise() { - local exerciseSlug="$1" - - bin/configlet sync -v q -e "$exerciseSlug" "${forwardedParameters[@]}" -} - -main() { - local -A uniqueSlugs=() - local -a exerciseSlugs - local exerciseSlug - - # Refresh 'problem-spec' cache once - bin/configlet info || exitWithFailure "configlet not ready to run offline" - - mapfile -t exerciseSlugs < "$scriptDirectory/auto-sync.txt" - - for exerciseSlug in "${exerciseSlugs[@]}"; do - if [[ "${uniqueSlugs[$exerciseSlug]}" == "set" ]]; then - reportRepeatedExercise "$exerciseSlug" - else - uniqueSlugs[$exerciseSlug]="set" - isNoPracticeExercise "${exerciseSlug}" && continue - syncPracticeExercise "${exerciseSlug}" - fi - done -} - -main +bin/configlet sync "${forwardedParameters[@]}" diff --git a/bin/auto-sync.txt b/bin/auto-sync.txt deleted file mode 100644 index f229a493..00000000 --- a/bin/auto-sync.txt +++ /dev/null @@ -1,109 +0,0 @@ -acronym -affine-cipher -all-your-base -allergies -alphametics -anagram -armstrong-numbers -atbash-cipher -baffling-birthdays -bank-account -binary-search -binary-search-tree -bob -book-store -bottle-song -bowling -change -circular-buffer -clock -collatz-conjecture -connect -crypto-square -darts -diamond -difference-of-squares -dnd-character -eliuds-eggs -etl -flatten-array -flower-field -food-chain -game-of-life -gigasecond -grade-school -grains -hamming -hello-world -high-scores -house -intergalactic-transmission -isbn-verifier -isogram -killer-sudoku-helper -kindergarten-garden -knapsack -largest-series-product -leap -line-up -linked-list -list-ops -luhn -markdown -matching-brackets -matrix -meetup -nth-prime -micro-blog -nucleotide-count -ocr-numbers -palindrome-products -pangram -pascals-triangle -perfect-numbers -phone-number -pig-latin -poker -prime-factors -protein-translation -proverb -queen-attack -rail-fence-cipher -raindrops -resistor-color -resistor-color-duo -resistor-color-trio -reverse-string -rna-transcription -robot-name -robot-simulator -roman-numerals -rotational-cipher -run-length-encoding -saddle-points -say -scrabble-score -secret-handshake -series -sieve -simple-cipher -space-age -spiral-matrix -square-root -state-of-tic-tac-toe -strain -sublist -sum-of-multiples -swift-scheduling -transpose -tournament -triangle -twelve-days -two-bucket -two-fer -variable-length-quantity -wordy -word-count -word-search -yacht -zebra-puzzle