Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow build to early exit on no significant changes #2232

Open
jleach opened this issue Oct 24, 2024 · 1 comment
Open

Allow build to early exit on no significant changes #2232

jleach opened this issue Oct 24, 2024 · 1 comment
Assignees
Milestone

Comments

@jleach
Copy link
Member

jleach commented Oct 24, 2024

Now that the iOS and Android native build are required checks it can take a long time to get a PR checked if it updates a non core file like README. This PR adds a check to see where the files were changed if if they are not significant allow an early exit on these steps.

@jleach jleach added this to the 1.0.21 milestone Oct 24, 2024
@jleach jleach self-assigned this Oct 24, 2024
@jleach
Copy link
Member Author

jleach commented Oct 28, 2024

I think like 101 should have || true after the grep command but that causes the script to fail when run as an action.

Working

change_count=$(echo "$diff_output" | grep -E '^(app/.*)|(.yarn/.*)|(.github/workflows/.*)' | wc -l | awk '{$1=$1};1' || true)

Fails

change_count=$(echo "$diff_output" | grep -E '^(app/.*)|(.yarn/.*)|(.github/workflows/.*)' || true | wc -l | awk '{$1=$1};1')
Comparing origin/main with HEAD
++ git diff --name-only origin/main..HEAD
+ diff_output=.github/workflows/main.yaml
++ echo .github/workflows/main.yaml
++ grep -E '^(app/.*)|(.yarn/.*)|(.github/workflows/.*)'
+ change_count=.github/workflows/main.yaml
.github/workflows/main.yaml files changed in app, .yarn, or .github/workflows
+ echo '.github/workflows/main.yaml files changed in app, .yarn, or .github/workflows'
+ '[' .github/workflows/main.yaml -gt 0 ']'
/home/runner/work/_temp/c6[40](https://github.com/bcgov/bc-wallet-mobile/actions/runs/11559048112/job/32172842752?pr=2240#step:3:41)cb30-5955-4315-812b-7e7c26d28ccf.sh: line 22: [: .github/workflows/main.yaml: integer expression expected
+ echo result=false

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant