Skip to content

Docs: cancel PR builds if there is no documentation changes #9734

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

Merged
merged 6 commits into from
Nov 22, 2022

Conversation

humitos
Copy link
Member

@humitos humitos commented Nov 15, 2022

Use the new feature to cancel builds if there are not documentation changes

Use the new feature to cancel builds if there are not documentation changes
Copy link
Contributor

@benjaoming benjaoming left a comment

Choose a reason for hiding this comment

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

LGTM! We should also be running this ASAP in production to make sure that we gather maximum hands-on experience with the approach :)

@benjaoming
Copy link
Contributor

@humitos we'll have to investigate why the latest build fails with exit code 1: https://readthedocs.org/projects/dev/builds/18636879/

@humitos humitos requested a review from a team as a code owner November 22, 2022 14:15
@humitos humitos requested a review from ericholscher November 22, 2022 14:15
@humitos humitos force-pushed the humitos/cancel-builds-if-no-docs-changes branch from a22d8dd to 66a78c6 Compare November 22, 2022 14:34
@humitos
Copy link
Member Author

humitos commented Nov 22, 2022

Meh, this doesn't work as we expected. When git diff returns 1 it exists immediately and break the build. We need a way to execute the git diff command and save its exit code into a variable without exiting the whole command.

We don't have to exit the command immediately when `git diff` exists with 1;
that means there are changes and we want to continue building the documentation.
@benjaoming
Copy link
Contributor

benjaoming commented Nov 22, 2022

If you want the one-liner, you can use ! git diff --quiet origin/main -- docs/ || exit 183

@humitos
Copy link
Member Author

humitos commented Nov 22, 2022

I don't think that works either. Have you tested it?

@humitos
Copy link
Member Author

humitos commented Nov 22, 2022

Cool! I figured it out. My last command change worked! 💪🏼

@benjaoming
Copy link
Contributor

I don't think that works either. Have you tested it?

Yes, worked fine locally 👍

Co-authored-by: Benjamin Balder Bach <[email protected]>
@humitos humitos enabled auto-merge (squash) November 22, 2022 15:26
@benjaoming
Copy link
Contributor

Since this does change docs/, we should remember to check that it actually "skips" builds after it's been merged :)

@humitos humitos merged commit 768e894 into main Nov 22, 2022
@humitos humitos deleted the humitos/cancel-builds-if-no-docs-changes branch November 22, 2022 15:39
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

Successfully merging this pull request may close these issues.

2 participants