Skip to content

Commit 6a466a2

Browse files
feat: add the directory workflow as a GitHub Action (#8)
* feat: convert the directory workflow to... ...GitHub Actions. The script is still kept, but GitHub Actions is preferred instead. * chore: apply suggestions from code review Co-authored-by: Taj <tjgurwara99@users.noreply.github.com>
1 parent d6eba75 commit 6a466a2

File tree

7 files changed

+71
-55
lines changed

7 files changed

+71
-55
lines changed
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: DIRECTORY.md workflow (ignore directories)
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
jobs:
7+
directory_builder:
8+
runs-on: ubuntu-latest
9+
name: Verify the DIRECTORY.md workflow works
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: ./directory_md
13+
with:
14+
language: C++
15+
working-directory: .
16+
filetypes: .cpp,.hpp
17+
ignored-directories: ./test

.github/workflows/directory.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: DIRECTORY.md workflow
2+
on:
3+
push:
4+
branches:
5+
- 'main'
6+
jobs:
7+
directory_builder:
8+
runs-on: ubuntu-latest
9+
name: Verify the DIRECTORY.md workflow works
10+
steps:
11+
- uses: actions/checkout@v3
12+
- uses: ./directory_md
13+
with:
14+
language: C++
15+
working-directory: ./test
16+
filetypes: .cpp,.hpp

.github/workflows/test.yml renamed to .github/workflows/formatter.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Test without ignore directory argument
2-
on: workflow_dispatch
2+
on:
3+
push:
4+
branches:
5+
- 'main'
36
jobs:
47
formatter:
58
runs-on: ubuntu-latest

directory_md/action.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: "Build directory file"
2+
description: "Builds a DIRECTORY.md file with all the algorithms in one repository."
3+
author: "TheAlgorithms"
4+
inputs:
5+
language:
6+
description: The language used in your repository
7+
required: true
8+
working-directory:
9+
description: Working/base directory of the script
10+
required: true
11+
default: .
12+
filetypes:
13+
description: Allowed filenames to check in (comma separated values in a string). Can have unlimited filetypes. E.g. `.cpp,.hpp,.h`
14+
required: true
15+
ignored-directories:
16+
description: Files or folders to ignore, separated by commas.
17+
required: false
18+
ignore-folders-children:
19+
description: Folders to ignore, but include children.
20+
required: false
21+
runs:
22+
using: composite
23+
steps:
24+
- run: echo "${{ github.action_path }}" >> $GITHUB_PATH
25+
shell: bash
26+
- name: Set up Python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: 3.10 # or whatever version you support
30+
- name: Running the formatter
31+
shell: bash
32+
run: |
33+
python ./build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md

filename_formatter.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ do
5151
git "mv" "${fname}" "${new_fname}" # Requires you to be in version control
5252
fi
5353
done
54-
unset IFS; set +f
54+
unset IFS; set +f

formatter/filename_formatter.sh

Lines changed: 0 additions & 53 deletions
This file was deleted.

0 commit comments

Comments
 (0)