From 4f4585d4c1e64251a5dd28a03ce330ae85ce8c2c Mon Sep 17 00:00:00 2001 From: David Leal Date: Fri, 19 May 2023 19:22:54 -0600 Subject: [PATCH 1/2] docs: improve `longest_palindromic_subsequence.cpp` (#2467) --- .../longest_palindromic_subsequence.cpp | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/dynamic_programming/longest_palindromic_subsequence.cpp b/dynamic_programming/longest_palindromic_subsequence.cpp index 870c43b9c0f..51fc028cfe6 100644 --- a/dynamic_programming/longest_palindromic_subsequence.cpp +++ b/dynamic_programming/longest_palindromic_subsequence.cpp @@ -1,7 +1,7 @@ /** * @file - * @brief Program to find the Longest Palindormic - * Subsequence of a string + * @brief Program to find the [Longest Palindormic + * Subsequence](https://www.geeksforgeeks.org/longest-palindromic-subsequence-dp-12/) of a string * * @details * [Palindrome](https://en.wikipedia.org/wiki/Palindrome) string sequence of @@ -18,8 +18,15 @@ #include /// for std::vector /** - * Function that returns the longest palindromic + * @namespace + * @brief Dynamic Programming algorithms + */ +namespace dynamic_programming { +/** + * @brief Function that returns the longest palindromic * subsequence of a string + * @param a string whose longest palindromic subsequence is to be found + * @returns longest palindromic subsequence of the string */ std::string lps(const std::string& a) { const auto b = std::string(a.rbegin(), a.rend()); @@ -70,17 +77,22 @@ std::string lps(const std::string& a) { return ans; } +} // namespace dynamic_programming -/** Test function */ -void test() { - assert(lps("radar") == "radar"); - assert(lps("abbcbaa") == "abcba"); - assert(lps("bbbab") == "bbbb"); - assert(lps("") == ""); +/** + * @brief Self-test implementations + * @returns void + */ +static void test() { + assert(dynamic_programming::lps("radar") == "radar"); + assert(dynamic_programming::lps("abbcbaa") == "abcba"); + assert(dynamic_programming::lps("bbbab") == "bbbb"); + assert(dynamic_programming::lps("") == ""); } /** - * Main Function + * @brief Main Function + * @returns 0 on exit */ int main() { test(); // execute the tests From 0934ec4a8a0c58143776b9e8e0faf1ccc2ea88ed Mon Sep 17 00:00:00 2001 From: David Leal Date: Fri, 19 May 2023 19:23:40 -0600 Subject: [PATCH 2/2] feat: label PR on CI fail (WIP) (#2455) * feat: label PR on CI fail * updating DIRECTORY.md --------- Co-authored-by: github-actions[bot] --- .github/workflows/awesome_workflow.yml | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/.github/workflows/awesome_workflow.yml b/.github/workflows/awesome_workflow.yml index 315629c981f..c4c398cd989 100644 --- a/.github/workflows/awesome_workflow.yml +++ b/.github/workflows/awesome_workflow.yml @@ -94,6 +94,8 @@ jobs: name: Compile checks runs-on: ${{ matrix.os }} needs: [MainSequence] + permissions: + pull-requests: write strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] @@ -101,5 +103,17 @@ jobs: - uses: actions/checkout@v3 with: submodules: true - - run: cmake -B ./build -S . - - run: cmake --build build + - run: | + cmake -B ./build -S . + cmake --build build + - name: Label on PR fail + uses: actions/github-script@v6 + if: ${{ failure() && matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }} + with: + script: | + github.rest.issues.addLabels({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + labels: ['automated tests are failing'] + })