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

ci: add conditional skip for docs changes #560

Merged
merged 1 commit into from
Jun 17, 2024

Conversation

zalimeni
Copy link
Member

@zalimeni zalimeni commented Jun 13, 2024

Similar to consul, skip build and tests if we're only changing docs.

This should help speed up releases and daily work quick-fixes.

❯ SKIP_CHECK_BRANCH=zalimeni/conditional-skip-ci GITHUB_OUTPUT="../GITHUB_OUTPUT" .github/scripts/check_skip_ci.sh
checking file: .changelog/100.txt
checking file: .github/scripts/check_skip_ci.sh
checking file: README.md
Changes detected in only documentation files - skipping tests and build

After adding a code change:

❯ SKIP_CHECK_BRANCH=zalimeni/conditional-skip-ci GITHUB_OUTPUT="../GITHUB_OUTPUT" .github/scripts/check_skip_ci.sh
checking file: .changelog/100.txt
checking file: .github/scripts/check_skip_ci.sh
checking file: README.md
checking file: cmd/consul-dataplane/main.go
non-skippable file changed: cmd/consul-dataplane/main.go
Changes detected in non-documentation files - will not skip tests and build

@zalimeni zalimeni requested a review from a team as a code owner June 13, 2024 15:49
@zalimeni zalimeni added pr/no-changelog This PR does not introduce a user-facing change that should be reflected in the changelog backport/1.1 Changes are backported to 1.1 backport/1.3 backport/1.4 Changes are backported to 1.4 backport/1.5 Changes are backported to 1.5 labels Jun 13, 2024
@zalimeni zalimeni force-pushed the zalimeni/conditional-skip-ci branch 4 times, most recently from 4550901 to 1d5ab56 Compare June 13, 2024 18:01
skipped_directories=("_doc/" ".changelog/")

# Loop through the changed files and find directories/files outside the skipped ones
files_to_check_array=($files_to_check)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were not converting to an array in the original script - it happened to still work due to multiline matches, but this allows us to print individual debug logs more accurately

@zalimeni zalimeni force-pushed the zalimeni/conditional-skip-ci branch 2 times, most recently from e940874 to e2dffb4 Compare June 13, 2024 18:34
@zalimeni
Copy link
Member Author

@zalimeni
Copy link
Member Author

zalimeni commented Jun 13, 2024

@nathancoleman or @DanStough when you get a sec, could I get a follow-up review of this change too? (basically the same as #560 apart from exempt directory list and integrated workflows)

- integration-tests
runs-on: ubuntu-latest
if: always()
if: always() && needs.conditional-skip.outputs.skip-ci != 'true'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So the action won't get stuck because this job is required and there are cases where we won't run it, correct?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Exactly. This follows the pattern in consul here

@zalimeni zalimeni requested a review from DanStough June 17, 2024 15:29
@zalimeni zalimeni force-pushed the zalimeni/conditional-skip-ci branch from f663c26 to 63d4bac Compare June 17, 2024 15:55
@zalimeni
Copy link
Member Author

Removed dead env var accidentally left in from consul script

@zalimeni zalimeni enabled auto-merge (squash) June 17, 2024 19:23
Copy link
Contributor

@DanStough DanStough left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport/1.1 Changes are backported to 1.1 backport/1.4 Changes are backported to 1.4 backport/1.5 Changes are backported to 1.5 pr/no-changelog This PR does not introduce a user-facing change that should be reflected in the changelog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants