diff --git a/.github/workflows/configlet.yml b/.github/workflows/configlet.yml deleted file mode 100644 index 47eb875..0000000 --- a/.github/workflows/configlet.yml +++ /dev/null @@ -1,15 +0,0 @@ -name: Configlet - -on: - pull_request: - push: - branches: - - main - workflow_dispatch: - -permissions: - contents: read - -jobs: - configlet: - uses: exercism/github-actions/.github/workflows/configlet.yml@main diff --git a/.github/workflows/important-files-changed.yml b/.github/workflows/important-files-changed.yml new file mode 100644 index 0000000..70102f2 --- /dev/null +++ b/.github/workflows/important-files-changed.yml @@ -0,0 +1,12 @@ +name: Important files changed +on: + pull_request: + types: [synchronize] + +jobs: + check_important_files_changes: + name: Check if any important files changed + runs-on: ubuntu-22.04 + steps: + - name: Check files changes + runs: ruby .github/bin/check-important-files-changed.rb diff --git a/.github/workflows/pause-community-contributions.yml b/.github/workflows/pause-community-contributions.yml deleted file mode 100644 index 9c731cf..0000000 --- a/.github/workflows/pause-community-contributions.yml +++ /dev/null @@ -1,25 +0,0 @@ -name: Pause Community Contributions - -on: - issues: - types: - - opened - pull_request_target: - types: - - opened - paths-ignore: - - 'exercises/*/*/.approaches/**' - - 'exercises/*/*/.articles/**' - -permissions: - issues: write - pull-requests: write - -jobs: - pause: - if: github.repository_owner == 'exercism' # Stops this job from running on forks - uses: exercism/github-actions/.github/workflows/community-contributions.yml@main - with: - forum_category: coffeescript - secrets: - github_membership_token: ${{ secrets.COMMUNITY_CONTRIBUTIONS_WORKFLOW_TOKEN }} diff --git a/.github/workflows/sync-labels.yml b/.github/workflows/sync-labels.yml deleted file mode 100644 index e7b99e5..0000000 --- a/.github/workflows/sync-labels.yml +++ /dev/null @@ -1,19 +0,0 @@ -name: Tools - -on: - push: - branches: - - main - paths: - - .github/labels.yml - - .github/workflows/sync-labels.yml - workflow_dispatch: - schedule: - - cron: 0 0 1 * * # First day of each month - -permissions: - issues: write - -jobs: - sync-labels: - uses: exercism/github-actions/.github/workflows/labels.yml@main diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml deleted file mode 100644 index d2daefa..0000000 --- a/.github/workflows/tests.yml +++ /dev/null @@ -1,20 +0,0 @@ -name: Tests -on: - pull_request: - push: - branches: - - main - schedule: - # Weekly. - - cron: '0 0 * * 0' - -jobs: - exercises: - name: Check exercises - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 - - name: Install CoffeeScript - run: npm install -g jasmine-node coffeescript - - name: Run tests - run: ./bin/test-exercises.sh \ No newline at end of file diff --git a/test.js b/test.js new file mode 100644 index 0000000..130984f --- /dev/null +++ b/test.js @@ -0,0 +1,88 @@ +const files = [ + { filename: ".github/workflows/test.yml" }, + { filename: "exercises/practice/anagram/.docs/instructions.md" }, + { filename: "exercises/practice/bob/.meta/config.json" }, + { filename: "exercises/practice/hello-world/hello-world.coffee" }, + { filename: "exercises/practice/hexadecimal/hexadecimal.spec.coffee" }, + { filename: "exercises/practice/binary/helper.coffee" }, + { filename: "exercises/practice/accumulate/.docs/instructions.md" }, + { filename: "exercises/practice/accumulate/accumulate.coffee" }, + { filename: "exercises/practice/accumulate/accumulate.spec.coffee" }, +]; + +const exerciseFiles = files.reduce((exerciseFiles, file) => { + const m = file.filename.match( + /^exercises\/(concept|practice)\/(?[^\/]+)\/(?.+)$/ + ); + + if (m == null) return exerciseFiles; + + const files = exerciseFiles.get(m.groups.slug) || []; + files.push(m.groups.filename); + + exerciseFiles.set(m.groups.slug, files); + return exerciseFiles; +}, new Map()); + +configs = { + bob: { + files: { + solution: ["bob.coffee"], + test: ["bob.spec.coffee"], + example: [".meta/example.coffee"], + }, + }, + anagram: { + files: { + solution: ["anagram.coffee"], + test: ["anagram.spec.coffee"], + example: [".meta/example.coffee"], + }, + }, + "hello-world": { + files: { + solution: ["hello-world.coffee"], + test: ["hello-world.spec.coffee"], + example: [".meta/example.coffee"], + }, + }, + hexadecimal: { + files: { + solution: ["hexadecimal.coffee"], + test: ["hexadecimal.spec.coffee"], + example: [".meta/example.coffee"], + }, + }, + binary: { + files: { + solution: ["hexadecimal.coffee"], + test: ["hexadecimal.spec.coffee"], + example: [".meta/example.coffee"], + invalidator: ["helper.coffee"], + }, + }, + accumulate: { + files: { + solution: ["accumulate.coffee"], + test: ["accumulate.spec.coffee"], + example: [".meta/example.coffee"], + }, + }, +}; +const x = Array.from(exerciseFiles.entries(), ([exercise, files]) => { + const exerciseConfig = configs[exercise]; + return files.filter( + (file) => + exerciseConfig.files.test.includes(file) || + exerciseConfig.files.editor?.includes(file) || + exerciseConfig.files.invalidator?.includes(file) + ); +}) + .flat() + .sort(); + +console.log(x); +// for (const [exercise, files] of exerciseFiles) { + +// console.log(exercise, importantFiles); +// }