{"id":16497168,"url":"https://github.com/guillaumefalourd/assert-command-line-output","last_synced_at":"2025-03-16T18:32:10.051Z","repository":{"id":40302212,"uuid":"378162556","full_name":"GuillaumeFalourd/assert-command-line-output","owner":"GuillaumeFalourd","description":"Github Action to assert / check a command line output 🕵️⚙️🖥","archived":false,"fork":false,"pushed_at":"2024-09-20T11:40:53.000Z","size":106,"stargazers_count":19,"open_issues_count":1,"forks_count":3,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-03-16T04:41:17.186Z","etag":null,"topics":["all-os-supported","assert","cli","command-line","github-actions","hacktoberfest","utilities"],"latest_commit_sha":null,"homepage":"https://github.com/marketplace/actions/assert-command-line-output","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GuillaumeFalourd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-06-18T13:41:06.000Z","updated_at":"2025-03-14T15:06:02.000Z","dependencies_parsed_at":"2024-03-15T13:50:13.297Z","dependency_job_id":"927b39e7-2a58-44f0-9c36-46af3f5157ff","html_url":"https://github.com/GuillaumeFalourd/assert-command-line-output","commit_stats":{"total_commits":166,"total_committers":3,"mean_commits":"55.333333333333336","dds":"0.21084337349397586","last_synced_commit":"fa9b6a143fd50e60dd5244d0479edceda4f3f598"},"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuillaumeFalourd%2Fassert-command-line-output","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuillaumeFalourd%2Fassert-command-line-output/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuillaumeFalourd%2Fassert-command-line-output/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GuillaumeFalourd%2Fassert-command-line-output/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GuillaumeFalourd","download_url":"https://codeload.github.com/GuillaumeFalourd/assert-command-line-output/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243910675,"owners_count":20367546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["all-os-supported","assert","cli","command-line","github-actions","hacktoberfest","utilities"],"created_at":"2024-10-11T14:38:37.065Z","updated_at":"2025-03-16T18:32:07.694Z","avatar_url":"https://github.com/GuillaumeFalourd.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"# Assert Command Line Output\n\n[![Public workflows that use this action.](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-endbug.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3DGuillaumeFalourd%2Fassert-command-line-output%26badge%3Dtrue)](https://github.com/search?o=desc\u0026q=GuillaumeFalourd+assert-command-line-output+path%3A.github%2Fworkflows+language%3AYAML\u0026s=\u0026type=Code) [![Action test on Ubuntu](https://github.com/GuillaumeFalourd/assert-command-line-output/actions/workflows/ubuntu_test_command_output.yml/badge.svg)](https://github.com/GuillaumeFalourd/check-command-line-output/actions/workflows/ubuntu_test_command_output.yml) [![Action test on MacOs](https://github.com/GuillaumeFalourd/assert-command-line-output/actions/workflows/macos_test_command_output.yml/badge.svg)](https://github.com/GuillaumeFalourd/assert-command-line-output/actions/workflows/macos_test_command_output.yml) [![Action test on Windows](https://github.com/GuillaumeFalourd/assert-command-line-output/actions/workflows/windows_test_command_output.yml/badge.svg)](https://github.com/GuillaumeFalourd/assert-command-line-output/actions/workflows/windows_test_command_output.yml)\n\n![title](https://user-images.githubusercontent.com/22433243/138319283-f2c06465-8ad5-4366-99d1-504a92e6b51e.png)\n\nGithub Action to assert / check a command line output 🕵️⚙️🖥\n\nThis action allows to compare a _command line output_ (success or error) with a _file content_ located on the repository, or to check if it contains a specific _expression_.\n\n---\n\n## 📚 Usage\n\n\u003c!-- [![Public workflows that use this action (V1).](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-endbug.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3DGuillaumeFalourd%2Ftest-cli-commands-action%26badge%3Dtrue)](https://github.com/search?o=desc\u0026q=GuillaumeFalourd+test-cli-commands-action+path%3A.github%2Fworkflows+language%3AYAML\u0026s=\u0026type=Code) ☞ [Who is using this action? (V1) 🧑‍💻](https://github.com/search?q=GuillaumeFalourd+test-cli-commands-action+path%3A.github%2Fworkflows+language%3AYAML\u0026type=code)\n\n[![Public workflows that use this action (V2).](https://img.shields.io/endpoint?url=https%3A%2F%2Fapi-endbug.vercel.app%2Fapi%2Fgithub-actions%2Fused-by%3Faction%3DGuillaumeFalourd%2Fassert-command-line-output%26badge%3Dtrue)](https://github.com/search?o=desc\u0026q=GuillaumeFalourd+assert-command-line-output+path%3A.github%2Fworkflows+language%3AYAML\u0026s=\u0026type=Code) ☞ [Who is using this action? (V2) 🧑‍💻](https://github.com/search?q=GuillaumeFalourd+assert-command-line-output+path%3A.github%2Fworkflows+language%3AYAML\u0026type=code) --\u003e\n\n### How does the action work?\n\n![how does the action work](https://user-images.githubusercontent.com/22433243/123486342-39901080-d5e2-11eb-94f2-3f45b4ed6205.png)\n\n### Requirements\n\n⚠️ The [`actions/checkout`](https://github.com/marketplace/actions/checkout) is mandatory to use this action, as it will be necessary to access the repository files, or to access the command line output file after the action execution.\n\n☞ _Note: This action gathers the logic from the [command-output-file-action](https://github.com/GuillaumeFalourd/command-output-file-action) and the [diff-action](https://github.com/GuillaumeFalourd/diff-action)_.\n\n---\n\n## ♻️ Scenarios\n\n### `1️⃣ Assert file content`\n\n#### Expecting command output to be EQUAL to `assert.txt` file content\n\n```yaml\nsteps:\n  - uses: actions/checkout@v4\n  - uses: GuillaumeFalourd/assert-command-line-output@v2.4\n    with:\n      command_line: ls -lha\n      assert_file_path: path/to/assert.txt\n      expected_result: PASSED\n```\n\n#### Expecting command output to be DIFFERENT than the `assert.txt` file content\n\n```yaml\nsteps:\n  - uses: actions/checkout@v4\n  - uses: GuillaumeFalourd/assert-command-line-output@v2.4\n    with:\n      command_line: ls -lha\n      assert_file_path: path/to/assert.txt\n      expected_result: FAILED\n```\n\n### `2️⃣ Assert specific file line`\n\n#### Expecting command output line 3 to be EQUAL than the `assert.txt` file content in line 3\n\n```yaml\nsteps:\n  - uses: actions/checkout@v4\n  - uses: GuillaumeFalourd/assert-command-line-output@v2.4\n    with:\n      command_line: ls -lha\n      assert_file_path: path/to/assert.txt\n      expected_result: PASSED\n      specific_line: 3\n```\n\n#### Expecting command output line 3 to be DIFFERENT than the `assert.txt` file content in line 3\n\n```yaml\nsteps:\n  - uses: actions/checkout@v4\n  - uses: GuillaumeFalourd/assert-command-line-output@v2.4\n    with:\n      command_line: ls -lha\n      assert_file_path: path/to/assert.txt\n      expected_result: FAILED\n      specific_line: 3\n```\n\n### `3️⃣ Assert specific expression`\n\n#### Expecting command output to contain specific expression\n\n```yaml\nsteps:\n  - uses: actions/checkout@v4\n  - uses: GuillaumeFalourd/assert-command-line-output@v2.4\n    with:\n      command_line: ls -lha\n      contains: runner\n      expected_result: PASSED\n```\n\n#### Expecting command output NOT to contain specific expression\n\n```yaml\nsteps:\n  - uses: actions/checkout@v4\n  - uses: GuillaumeFalourd/assert-command-line-output@v2.4\n    with:\n      command_line: ls -lha\n      contains: error\n      expected_result: FAILED\n```\n\n### `4️⃣ Multiple-line commands`\n\nThe assert may fail while using multiple-line commands. When this is necessary, use single quotes `'`.\n\n```yaml\nsteps:\n  - uses: actions/checkout@v4\n  - uses: GuillaumeFalourd/assert-command-line-output@v2.4\n    with:\n      command_line: | \n        'a_very_long_command --that --need\n        --multiple --lines --to --write'\n      assert_file_path: path/to/assert.txt\n      expected_result: PASSED\n```\n\n---\n\n## ▶️ Action Inputs\n\n| Field                | Mandatory | Observation                                                                                                                                      |\n| -------------------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------ |\n| **command_line**     | YES       | Command Line to assert / check. \u003cbr/\u003e _e.g: `ls -lha`_                                                                                           |\n| **assert_file_path** | NO        | Path to assert file that will be compared to command line output. \u003cbr/\u003e _e.g: `path/to/assert.txt`_                                              |\n| **specific_line**    | NO        | Specific line to check from output file with assert file. \u003cbr/\u003e **NEEDS** `assert_file_path` configured. \u003cbr/\u003e _e.g: `1` (*integer value only*)_ |\n| **contains**         | NO        | String expression to check on the command line output. \u003cbr/\u003e _e.g: `string expression`_                                                          |\n| **expected_result**  | NO        | Expected assert output. \u003cbr/\u003e _e.g: `PASSED` (*default*) or `FAILED`_                                                                            |\n| **work_dir**  | NO        | Use the input as working directory to run the action.                                                                           |\n\n### 🔎 Good to know\n\n- At least **one type of assert** between `contains`, `specific_line` and `assert_file_path` has to be configured.\n\n- If **more than one type of assert** is set, the priority between them is:\n\n  - 1️⃣ `contains`\n  - 2️⃣ `specific_line`\n  - 3️⃣ `assert_file_path`\n\n- You can access the **output.txt file** in the repository directory **after running the action**.\n\n---\n\n## 🤝 Contributing\n\n☞ [Guidelines](https://github.com/GuillaumeFalourd/test-cli-commands-action/blob/main/CONTRIBUTING.md)\n\n## 🏅 Licensed\n\n☞ This repository uses the [Apache License 2.0](https://github.com/GuillaumeFalourd/assert-command-line-output/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguillaumefalourd%2Fassert-command-line-output","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguillaumefalourd%2Fassert-command-line-output","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguillaumefalourd%2Fassert-command-line-output/lists"}