I'm trying to compile all my C projects within an Action on GitHub.
This is the command I'm running:
\! find . -name Makefile -type f -execdir make re \; 2>&1 | grep -qF 'Error 1'
It exits 1 if grep
finds 'Error 1', which is what make
displays when it fails. Locally it works fine, and I've even pulled a fresh branch to make sure it wasn't some local changes which caused a biased result. But nothing...
This is what is displayed in my pipeline:
2023-02-21T13:45:13.6257013Z ##[group]Run \! find . -name Makefile -type f -execdir make re \; 2>&1 | grep -qF 'Error 1'
2023-02-21T13:45:13.6257510Z [36;1m\! find . -name Makefile -type f -execdir make re \; 2>&1 | grep -qF 'Error 1'[0m
2023-02-21T13:45:13.6313689Z shell: /usr/bin/bash -e {0}
2023-02-21T13:45:13.6313965Z ##[endgroup]
2023-02-21T13:45:13.6506466Z ##[error]Process completed with exit code 1.
I've also tried putting the script into a build.sh
file, but I get a grep: conflicting matchers specified
warning, and no error (even if make
error is forced)
Tests I've performed:
- Raw script (action link | workflow link) => Exits 1 for no reason
- Script in file (action link | script link) => Exits 0 for no reason + grep warning
- Script in file (forced error) (actions link | script link) => Exits 0 for no reason + grep warning
If there's a better alternative to the command I'm using, which compiles all Makefiles in immediate subdirectories, that would be great too! :)