From a3d6183b7be96ddc7aba62ba2a01b3ff71f6ad6b Mon Sep 17 00:00:00 2001 From: Taj Date: Fri, 20 Jan 2023 20:02:41 +0000 Subject: [PATCH 01/18] Moved the formatter script to the formatter action path (#14) * Moved the formatter script to the formatter action path * Add filename formatter in root For backward compatibility. Co-authored-by: David Leal --- filename_formatter.sh | 0 formatter/action.yml | 2 +- formatter/filename_formatter.sh | 60 +++++++++++++++++++++++++++++++++ 3 files changed, 61 insertions(+), 1 deletion(-) mode change 100755 => 100644 filename_formatter.sh create mode 100755 formatter/filename_formatter.sh diff --git a/filename_formatter.sh b/filename_formatter.sh old mode 100755 new mode 100644 diff --git a/formatter/action.yml b/formatter/action.yml index cb7cbd5..cc232b2 100644 --- a/formatter/action.yml +++ b/formatter/action.yml @@ -25,7 +25,7 @@ runs: - name: Running the formatter shell: bash run: | - ./filename_formatter.sh ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignore-files }} + filename_formatter.sh ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignore-files }} - name: Committing changes shell: bash run: | diff --git a/formatter/filename_formatter.sh b/formatter/filename_formatter.sh new file mode 100755 index 0000000..cc9bfed --- /dev/null +++ b/formatter/filename_formatter.sh @@ -0,0 +1,60 @@ +#!/bin/bash + +echo -e "Arguments: +[0] - Used by Bash (script filename) +[1] - Base directory +[2] - Filename type (maximum two values) +[3] - Ignored files or folders (optional; use "\""./"\"") +" + +# Separate $2 value (filename types) if it has a comma +if [[ "$2" == *","* ]]; +then + string="$2" + + str_value=${string#*,} + str_value2=${string%%,*} +else + str_value="$2" + str_value2="$2" +fi + +# Do not run script if there are no given arguments. +if [[ "$1" == "" ]] || [[ "$2" == "" ]]; +then + echo "No arguments given. Please specify minimum two arguments." + exit 1 +fi + +echo "Changed files:" + +IFS=$'\n'; set -f +for fname in $(find $1 -type f -name "*$str_value2" -or -name "*$str_value") +do + ignored_files="$(echo "$3" | tr "," "\n")" + + str="${fname}" + value=${str%/*} # If the base directory is `.`, check in all directories for the ignored filenames + + for files in $ignored_files + do + if [ "${fname}" == "$value/$files" ] || [ "$value" == "$files" ]; + then + continue 2 + fi + done + + #echo ${fname} + new_fname=$(echo "${fname}" | tr ' ' '_') + #echo " ${new_fname}" + new_fname=$(echo "${new_fname}" | tr '[:upper:]' '[:lower:]') + #echo " ${new_fname}" + new_fname=$(echo "${new_fname}" | tr '-' '_') + #echo " ${new_fname}" + if [ "${fname}" != "${new_fname}" ] + then + echo " ${fname} --> ${new_fname}" + git "mv" "${fname}" "${new_fname}" # Requires you to be in version control + fi +done +unset IFS; set +f From 8c4dc102869c3bf7433fa06f28e2a99d9f806178 Mon Sep 17 00:00:00 2001 From: David Leal Date: Fri, 20 Jan 2023 17:46:30 -0600 Subject: [PATCH 02/18] Add the directory workflow in the action folder (#15) --- directory_md/action.yml | 2 +- directory_md/build_directory_md.py | 76 ++++++++++++++++++++++++++++++ 2 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 directory_md/build_directory_md.py diff --git a/directory_md/action.yml b/directory_md/action.yml index dd1161d..6f7edc3 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -35,7 +35,7 @@ runs: - name: Running the formatter shell: bash run: | - python ./build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md + python build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md - name: Committing changes shell: bash run: | diff --git a/directory_md/build_directory_md.py b/directory_md/build_directory_md.py new file mode 100644 index 0000000..cea42ff --- /dev/null +++ b/directory_md/build_directory_md.py @@ -0,0 +1,76 @@ +#!/usr/bin/env python3 + +import os +import sys +from typing import Iterator + +if ".py" in sys.argv[0]: + sys.argv.pop(0) + + +if len(sys.argv) not in (3, 4, 5): + print( + "Arguments:\n" + "[0] - Language\n" + "[1] - Base path\n" + "[2] - Allowed filenames\n" + "[3] - Files or folders to ignore (optional)\n" + "[4] - Folders to ignore, but include children (optional)" + ) + sys.exit() + +ignore = [] +skip = [] +if len(sys.argv) == 4: + ignore = sys.argv[3].split(",") +if len(sys.argv) == 5: + skip = sys.argv[4].split(",") + +URL_BASE = f"https://github.com/TheAlgorithms/{sys.argv[0]}/blob/HEAD" + + +def good_file_paths(top_dir: str = ".") -> Iterator[str]: + for dir_path, dir_names, filenames in os.walk(top_dir): + dir_names[:] = [d for d in dir_names if d != "scripts" and d[0] not in "._"] + for filename in filenames: + if filename == "__init__.py": + continue + if any( + e.lower() in os.path.join(dir_path, filename).lower() for e in ignore + ): + continue + if os.path.splitext(filename)[1] in sys.argv[2].split(","): + path = os.path.join(dir_path, filename).lstrip(".").lstrip("/") + for e in skip: + path = path.replace(e + "/", "") + path = path.replace(e + "\\", "") + yield path + + +def md_prefix(i): + return f"{i * ' '}*" if i else "\n##" + + +def print_path(old_path: str, new_path: str) -> str: + old_parts = old_path.split(os.sep) + for i, new_part in enumerate(new_path.split(os.sep)): + if i + 1 > len(old_parts) or old_parts[i] != new_part: + if new_part: + print(f"{md_prefix(i)} {new_part.replace('_', ' ').title()}") + return new_path + + +def print_directory_md(top_dir: str = ".") -> None: + old_path = "" + for filepath in sorted(good_file_paths(top_dir)): + filepath, filename = os.path.split(filepath) + if filepath != old_path: + old_path = print_path(old_path, filepath) + indent = (filepath.count(os.sep) + 1) if filepath else 0 + url = "/".join((URL_BASE, filepath, filename)).replace(" ", "%20") + filename = os.path.splitext(filename.replace("_", " ").title())[0] + print(f"{md_prefix(indent)} [{filename}]({url})") + + +if __name__ == "__main__": + print_directory_md(sys.argv[1]) From a708d83b070ee876eb366466c9e77dba3e912f01 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Thu, 23 Mar 2023 22:23:38 +0100 Subject: [PATCH 03/18] Set ignores if there are skips (#20) `ignore` was not getting set `if len(args) == 5` --- build_directory_md.py | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/build_directory_md.py b/build_directory_md.py index cea42ff..c7e80ac 100644 --- a/build_directory_md.py +++ b/build_directory_md.py @@ -19,12 +19,8 @@ ) sys.exit() -ignore = [] -skip = [] -if len(sys.argv) == 4: - ignore = sys.argv[3].split(",") -if len(sys.argv) == 5: - skip = sys.argv[4].split(",") +ignore = sys.argv[3].split(",") if len(sys.argv) >= 4 else [] +skip = sys.argv[4].split(",") if len(sys.argv) == 5 else [] URL_BASE = f"https://github.com/TheAlgorithms/{sys.argv[0]}/blob/HEAD" @@ -33,17 +29,14 @@ def good_file_paths(top_dir: str = ".") -> Iterator[str]: for dir_path, dir_names, filenames in os.walk(top_dir): dir_names[:] = [d for d in dir_names if d != "scripts" and d[0] not in "._"] for filename in filenames: - if filename == "__init__.py": - continue - if any( + if filename == "__init__.py" or any( e.lower() in os.path.join(dir_path, filename).lower() for e in ignore ): continue if os.path.splitext(filename)[1] in sys.argv[2].split(","): path = os.path.join(dir_path, filename).lstrip(".").lstrip("/") for e in skip: - path = path.replace(e + "/", "") - path = path.replace(e + "\\", "") + path = path.replace(f"{e}/", "").replace(f"{e}\\", "") yield path From 6b29901442eff2f9cc924df59a24c386d95e4e11 Mon Sep 17 00:00:00 2001 From: David Leal Date: Sun, 11 Jun 2023 16:47:17 -0600 Subject: [PATCH 04/18] Add `README.md` in the `test` folder --- test/README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 test/README.md diff --git a/test/README.md b/test/README.md new file mode 100644 index 0000000..6d23a57 --- /dev/null +++ b/test/README.md @@ -0,0 +1,4 @@ +# Testing + +This folder is used only for testing purposes.\ +This should not be touched or modified in any way. From d10fd5161457ad987d069c02f45549d61926a1c2 Mon Sep 17 00:00:00 2001 From: Alexander Pantyukhin Date: Tue, 13 Jun 2023 20:29:27 +0400 Subject: [PATCH 05/18] Create copyright license script (#22) * Update copyright license * Update license_copyright/license.yml Co-authored-by: Taj * Update license_copyright/license.yml Co-authored-by: Taj * Update license_copyright/license.yml Co-authored-by: David Leal * Update license_copyright/license.yml Co-authored-by: David Leal * chore: apply suggestions from code review * Update license_copyright/license.yml Co-authored-by: David Leal * Update license_copyright/license.yml Co-authored-by: David Leal * chore: apply suggestions from code review --------- Co-authored-by: Taj Co-authored-by: David Leal --- license_copyright/license.yml | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 license_copyright/license.yml diff --git a/license_copyright/license.yml b/license_copyright/license.yml new file mode 100644 index 0000000..9777188 --- /dev/null +++ b/license_copyright/license.yml @@ -0,0 +1,37 @@ +name: 'Update copyright license' +description: Update license years automatically +author: "TheAlgorithms" +inputs: + filename: + description: License file name + required: true + default: LICENSE +initial_year: + description: Year of the repository's creation + required: true + default: 2016 +runs: + using: composite + steps: + - name: Update the License + run: | + (echo "Copyright (C) ${{ inputs.initial_year }}-$(date +"%Y") TheAlgorithms and contributors"; tail -n +2 ${{ inputs.filename }}) > License.tmp + mv License.tmp ${{ inputs.filename }} + - name: Setup Git configurations + shell: bash + run: | + git config --global user.name github-actions[bot] + git config --global user.email 'github-actions@users.noreply.github.com' + - name: Commit to a new branch and push changes + shell: bash + run: | + git checkout -b license-update-${{ github.sha }} + git commit -m "docs: updating copyright license year" + git push + - name: Creating and merging the PR + shell: bash + run: | + if [[ `git status --porcelain` ]]; then + gh pr create --base master --head license-update-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).' + env: + GH_TOKEN: ${{ github.token }} From 124f3370d8aa907448a9d1155f3785a03bf743df Mon Sep 17 00:00:00 2001 From: David Leal Date: Tue, 13 Jun 2023 20:25:56 -0600 Subject: [PATCH 06/18] Create PR rather than direct commit (directory workflow) (#24) * Create PR rather than direct commit (directory workflow) * chore: apply suggestions from code review Co-authored-by: Taj --------- Co-authored-by: Taj --- directory_md/action.yml | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/directory_md/action.yml b/directory_md/action.yml index 6f7edc3..19a007c 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -26,18 +26,27 @@ runs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.10' # or whatever version you support + python-version: '3.x' - name: Setup Git configurations shell: bash run: | git config --global user.name github-actions[bot] git config --global user.email 'github-actions@users.noreply.github.com' - - name: Running the formatter + - name: Running the directory builder shell: bash run: | python build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md - name: Committing changes shell: bash run: | - git commit -m "chore: update `DIRECTORY.md`" DIRECTORY.md || true - git push origin HEAD:$GITHUB_REF || true + git branch directory-update + git checkout directory-update + + git commit -m "docs: update `DIRECTORY.md`" DIRECTORY.md || true + git push origin directory-update:directory-update --force + - name: Creating a pull request + shell: bash + run: | + if [[ `git status --porcelain` ]]; then + gh pr create --base ${GITHUB_REF##*/} --head directory-update --title 'docs: updating `DIRECTORY.md`' --body 'Updated the `DIRECTORY.md` file (see the diff. for changes).' || true + # `true` is needed in case the PR has been already created to prevent the CI to fail. The changes will already be pushed to the current PR's branch. From e9191809b5c28026f2ec945202d6b391909c305b Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 14 Jun 2023 09:15:05 -0600 Subject: [PATCH 07/18] Fix directory workflow script (#25) * Fix directory workflow script * Let the user choose the branch name --- .github/workflows/directory-ignore-files.yml | 1 + .github/workflows/directory.yml | 1 + directory_md/action.yml | 33 ++++++++++++++------ 3 files changed, 26 insertions(+), 9 deletions(-) diff --git a/.github/workflows/directory-ignore-files.yml b/.github/workflows/directory-ignore-files.yml index 58a93c7..7d391ab 100644 --- a/.github/workflows/directory-ignore-files.yml +++ b/.github/workflows/directory-ignore-files.yml @@ -15,3 +15,4 @@ jobs: working-directory: . filetypes: .cpp,.hpp ignored-directories: ./test + branch-name: directory-update-ignore diff --git a/.github/workflows/directory.yml b/.github/workflows/directory.yml index 97e2361..9cf385b 100644 --- a/.github/workflows/directory.yml +++ b/.github/workflows/directory.yml @@ -14,3 +14,4 @@ jobs: language: scripts working-directory: ./test filetypes: .cpp,.hpp + branch-name: directory-update diff --git a/directory_md/action.yml b/directory_md/action.yml index 19a007c..284a0c2 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -18,6 +18,10 @@ inputs: ignore-folders-children: description: Folders to ignore, but include children. required: false + branch-name: + description: The branch that will be used to push changes. + required: false + default: directory-update runs: using: composite steps: @@ -35,18 +39,29 @@ runs: - name: Running the directory builder shell: bash run: | + # If branch exists, change to that branch to prevent multiple committing/PR creation. + git checkout ${{ inputs.branch-name }} || true + python build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md - - name: Committing changes + - name: Creating a branch shell: bash run: | - git branch directory-update - git checkout directory-update + git branch ${{ inputs.branch-name }} || true + git checkout ${{ inputs.branch-name }} || true - git commit -m "docs: update `DIRECTORY.md`" DIRECTORY.md || true - git push origin directory-update:directory-update --force - - name: Creating a pull request + - name: Committing, pushing, and creating a PR shell: bash run: | - if [[ `git status --porcelain` ]]; then - gh pr create --base ${GITHUB_REF##*/} --head directory-update --title 'docs: updating `DIRECTORY.md`' --body 'Updated the `DIRECTORY.md` file (see the diff. for changes).' || true - # `true` is needed in case the PR has been already created to prevent the CI to fail. The changes will already be pushed to the current PR's branch. + if [[ `git status --porcelain` ]]; + then + + git add DIRECTORY.md + + git commit -m "docs: update DIRECTORY.md" || true + git push origin ${{ inputs.branch-name }}:${{ inputs.branch-name }} --force + + gh pr create --base ${GITHUB_REF##*/} --head ${{ inputs.branch-name }} --title 'docs: updating `DIRECTORY.md`' --body 'Updated the `DIRECTORY.md` file (see the diff. for changes).' || true + # Using `true` will make sure no errors are displayed even if there's a PR created. + fi + env: + GH_TOKEN: ${{ github.token }} From ada8bfd5d2509055cdc6877b90cc10dd0c950cce Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 14 Jun 2023 15:26:39 +0000 Subject: [PATCH 08/18] Use `workflow_dispatch` --- .github/workflows/directory-ignore-files.yml | 5 +---- .github/workflows/directory.yml | 5 +---- .github/workflows/formatter-ignore-files.yml | 5 +---- .github/workflows/formatter.yml | 5 +---- 4 files changed, 4 insertions(+), 16 deletions(-) diff --git a/.github/workflows/directory-ignore-files.yml b/.github/workflows/directory-ignore-files.yml index 7d391ab..65d7704 100644 --- a/.github/workflows/directory-ignore-files.yml +++ b/.github/workflows/directory-ignore-files.yml @@ -1,8 +1,5 @@ name: DIRECTORY.md workflow (ignore directories) -on: - push: - branches: - - 'main' +on: [workflow_dispatch] jobs: directory_builder: runs-on: ubuntu-latest diff --git a/.github/workflows/directory.yml b/.github/workflows/directory.yml index 9cf385b..830cfdb 100644 --- a/.github/workflows/directory.yml +++ b/.github/workflows/directory.yml @@ -1,8 +1,5 @@ name: DIRECTORY.md workflow -on: - push: - branches: - - 'main' +on: [workflow_dispatch] jobs: directory_builder: runs-on: ubuntu-latest diff --git a/.github/workflows/formatter-ignore-files.yml b/.github/workflows/formatter-ignore-files.yml index c6dce04..9c177a2 100644 --- a/.github/workflows/formatter-ignore-files.yml +++ b/.github/workflows/formatter-ignore-files.yml @@ -1,8 +1,5 @@ name: Test with ignore directory argument -on: - push: - branches: - - 'main' +on: [workflow_dispatch] jobs: formatter: runs-on: ubuntu-latest diff --git a/.github/workflows/formatter.yml b/.github/workflows/formatter.yml index e6fbb5c..d49c63d 100644 --- a/.github/workflows/formatter.yml +++ b/.github/workflows/formatter.yml @@ -1,8 +1,5 @@ name: Test without ignore directory argument -on: - push: - branches: - - 'main' +on: [workflow_dispatch] jobs: formatter: runs-on: ubuntu-latest From f5dfb90d28e57026d3166e5e788701b0dce2937c Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 14 Jun 2023 10:27:03 -0600 Subject: [PATCH 09/18] Use `--force-with-lease` --- directory_md/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory_md/action.yml b/directory_md/action.yml index 284a0c2..f84e500 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -58,7 +58,7 @@ runs: git add DIRECTORY.md git commit -m "docs: update DIRECTORY.md" || true - git push origin ${{ inputs.branch-name }}:${{ inputs.branch-name }} --force + git push origin ${{ inputs.branch-name }}:${{ inputs.branch-name }} --force-with-lease gh pr create --base ${GITHUB_REF##*/} --head ${{ inputs.branch-name }} --title 'docs: updating `DIRECTORY.md`' --body 'Updated the `DIRECTORY.md` file (see the diff. for changes).' || true # Using `true` will make sure no errors are displayed even if there's a PR created. From cbc710e1ec650a4fc7ac622ebec53de221442c79 Mon Sep 17 00:00:00 2001 From: Taj Date: Mon, 3 Jul 2023 12:01:40 +0100 Subject: [PATCH 10/18] Fix bug in directory action (#29) This is a patch to issue https://github.com/TheAlgorithms/scripts/issues/27 To test this I need to whip up something --- directory_md/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory_md/action.yml b/directory_md/action.yml index f84e500..aa3faa2 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -42,7 +42,7 @@ runs: # If branch exists, change to that branch to prevent multiple committing/PR creation. git checkout ${{ inputs.branch-name }} || true - python build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md + python ./build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md - name: Creating a branch shell: bash run: | From 619ac063459abecf007f06779b6e44305d76785b Mon Sep 17 00:00:00 2001 From: David Leal Date: Mon, 3 Jul 2023 13:30:17 -0600 Subject: [PATCH 11/18] fix: copyright license script (#28) * fix: copyright license script * fix: use proper GitHub branch * chore: apply suggestions from code review Co-authored-by: Taj --------- Co-authored-by: Taj --- license_copyright/license.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index 9777188..9c56e1f 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -1,13 +1,13 @@ name: 'Update copyright license' -description: Update license years automatically +description: Updates copyright license year automatically author: "TheAlgorithms" inputs: filename: - description: License file name + description: "License filename" required: true default: LICENSE initial_year: - description: Year of the repository's creation + description: "Year of the repository's creation" required: true default: 2016 runs: @@ -27,11 +27,12 @@ runs: run: | git checkout -b license-update-${{ github.sha }} git commit -m "docs: updating copyright license year" - git push + git push origin license-update-${{ github.sha }}:license-update-${{ github.sha }} - name: Creating and merging the PR shell: bash run: | - if [[ `git status --porcelain` ]]; then - gh pr create --base master --head license-update-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).' + if [[ $(git log --branches --not --remotes) ]]; then + gh pr create --base ${GITHUB_REF##*/} --head license-update-${{ github.sha }} --title 'docs: updating `License` copyright' --body 'Updated License copyright (see the diff. for changes).' + fi env: GH_TOKEN: ${{ github.token }} From fe0a1c65f4192f880cfe50c4dcc948fe60d5d7fe Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 5 Jul 2023 15:19:11 -0600 Subject: [PATCH 12/18] Update license.yml --- license_copyright/license.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/license_copyright/license.yml b/license_copyright/license.yml index 9c56e1f..1cb8289 100644 --- a/license_copyright/license.yml +++ b/license_copyright/license.yml @@ -28,7 +28,7 @@ runs: git checkout -b license-update-${{ github.sha }} git commit -m "docs: updating copyright license year" git push origin license-update-${{ github.sha }}:license-update-${{ github.sha }} - - name: Creating and merging the PR + - name: Creating a PR shell: bash run: | if [[ $(git log --branches --not --remotes) ]]; then From b68cc98b4b39ad51f6861d6a697a8504398fb774 Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 5 Jul 2023 15:21:10 -0600 Subject: [PATCH 13/18] Add codeowners (#32) --- .github/CODEOWNERS | 1 + 1 file changed, 1 insertion(+) create mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..f25a73d --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @Panquesito7 @tjgurwara99 From be5a4f8f3f8b65bbc15a39f10986af818e2138d8 Mon Sep 17 00:00:00 2001 From: Taj Date: Fri, 4 Aug 2023 00:24:11 +0100 Subject: [PATCH 14/18] Use specific action_path instead of relying on PATH resolution of the action setup (#33) * revert: cbc710e1ec650a4fc7ac622ebec53de221442c79 * Use the specific action directory when calling the script * Use specific action_path when using formatter script --- directory_md/action.yml | 4 ++-- formatter/action.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/directory_md/action.yml b/directory_md/action.yml index aa3faa2..d773682 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -30,7 +30,7 @@ runs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: '3.x' + python-version: "3.x" - name: Setup Git configurations shell: bash run: | @@ -42,7 +42,7 @@ runs: # If branch exists, change to that branch to prevent multiple committing/PR creation. git checkout ${{ inputs.branch-name }} || true - python ./build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md + python ${{ github.action_path }}/build_directory_md.py ${{ inputs.language }} ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignored-directories }} ${{ inputs.ignore-folders-children }} > DIRECTORY.md - name: Creating a branch shell: bash run: | diff --git a/formatter/action.yml b/formatter/action.yml index cc232b2..c2065cc 100644 --- a/formatter/action.yml +++ b/formatter/action.yml @@ -25,7 +25,7 @@ runs: - name: Running the formatter shell: bash run: | - filename_formatter.sh ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignore-files }} + ${{ github.action_path }}/filename_formatter.sh ${{ inputs.working-directory }} ${{ inputs.filetypes }} ${{ inputs.ignore-files }} - name: Committing changes shell: bash run: | From bf633099446f3eef3d37dd1ed5e7f552f409800d Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 6 Sep 2023 11:38:57 -0600 Subject: [PATCH 15/18] Use correct GitHub Actions bot name --- directory_md/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/directory_md/action.yml b/directory_md/action.yml index d773682..ffc5b8a 100644 --- a/directory_md/action.yml +++ b/directory_md/action.yml @@ -35,7 +35,7 @@ runs: shell: bash run: | git config --global user.name github-actions[bot] - git config --global user.email 'github-actions@users.noreply.github.com' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' - name: Running the directory builder shell: bash run: | From a775dfde9801ee060ab9afe88742af7941662314 Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 6 Sep 2023 11:39:23 -0600 Subject: [PATCH 16/18] Update action.yml --- formatter/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/formatter/action.yml b/formatter/action.yml index c2065cc..daa0649 100644 --- a/formatter/action.yml +++ b/formatter/action.yml @@ -21,7 +21,7 @@ runs: shell: bash run: | git config --global user.name github-actions[bot] - git config --global user.email 'github-actions@users.noreply.github.com' + git config --global user.email 'github-actions[bot]@users.noreply.github.com' - name: Running the formatter shell: bash run: | From 4d5e12fc0ad241ca18f67d34650f48a90fee946c Mon Sep 17 00:00:00 2001 From: David Leal Date: Fri, 22 Sep 2023 10:26:11 -0600 Subject: [PATCH 17/18] Add a self-test for the license copyright workflow (#34) --- .github/workflows/license_copyright.yml | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .github/workflows/license_copyright.yml diff --git a/.github/workflows/license_copyright.yml b/.github/workflows/license_copyright.yml new file mode 100644 index 0000000..17ddf26 --- /dev/null +++ b/.github/workflows/license_copyright.yml @@ -0,0 +1,11 @@ +name: License Copyright test +on: [workflow_dispatch] +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: ./license-copyright + with: + filename: LICENSE + initial_year: 2021 From 1e1584a3fb13cad11d062d4d1f35acc8c50a4118 Mon Sep 17 00:00:00 2001 From: David Leal Date: Wed, 4 Oct 2023 16:30:12 -0600 Subject: [PATCH 18/18] Update action.yml --- formatter/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/formatter/action.yml b/formatter/action.yml index daa0649..7ac3e7d 100644 --- a/formatter/action.yml +++ b/formatter/action.yml @@ -1,16 +1,16 @@ name: "Filename Formatter" -description: "Format filenames into the acceptable format by TheAlgorithms opganization" +description: "Format filenames into the acceptable format by TheAlgorithms organization" author: "TheAlgorithms" inputs: filetypes: - description: Filter files by specified file types (comma separated values in a string.) Maximum two values. E.g. `.cpp,.hpp` + description: Filter files by specified file types (comma-separated values in a string.) Maximum two values. E.g. `.cpp,.hpp` required: true working-directory: description: Working/base directory of the formatter required: false default: . ignore-files: - description: Files/folders to ignored + description: Files/folders to be ignored required: false runs: using: composite