Skip to content

Conversation

@BenWhitehead
Copy link
Collaborator

No description provided.

@BenWhitehead BenWhitehead added the owlbot:ignore instruct owl-bot to ignore a PR label Jul 2, 2024
@BenWhitehead BenWhitehead requested review from a team as code owners July 2, 2024 21:06
@product-auto-label product-auto-label bot added size: xs Pull request size is extra small. api: storage Issues related to the googleapis/java-storage API. labels Jul 2, 2024
Copy link
Contributor

@diegomarquezp diegomarquezp left a comment

Choose a reason for hiding this comment

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

The underlying script already does this check. We need the workflow to run when the last commit has affected generation_config.yaml. Otherwise we would have a loop (generation_config -> source code + generation_config -> source code + generation_config)

change_of_last_commit="$(git diff-tree --no-commit-id --name-only HEAD~1..HEAD -r)"
if [[ ! ("${change_of_last_commit}" == *"${generation_config}"*) ]]; then
echo "The last commit doesn't contain any changes to the generation_config.yaml, skipping the whole generation process." || true
exit 0
fi

We may expand this check to allow other files being modified, such as the OwlBot yaml, or even some more sophisticated logic.

cc: @JoeWang1127

@BenWhitehead
Copy link
Collaborator Author

I acknowledge that the script detects this, but github will also fail if the action is present on a branch that does not have a token. My preference would be that the workflow for the generation script not even attempt to access the token until a "write step", but the current script is all or nothing. Filtering on input change seems like an okay compromise.

image

RE:

run when the last commit has affected generation_config.yaml

Could this be a check in the script $COMMITISH == HEAD if it matches proceed, otherwise exit as not applicable.

@diegomarquezp
Copy link
Contributor

@BenWhitehead, we have disabled the check on PRs that come from fork (i.e. repos that don't have the token).

if: github.event.pull_request.head.repo.full_name == github.repository

For all other PRs, the token should be accessible since it's a repo-level secret.

Regarding the screenshot you shared, would you mind sharing the link to it to see which PR it comes from? I suspect it's either a workflow run from before we set the token or from a fork.

cc: @blakeli0 @JoeWang1127

@BenWhitehead
Copy link
Collaborator Author

Spoke offline to get consensus.

@BenWhitehead BenWhitehead merged commit 34e99b1 into main Jul 8, 2024
@BenWhitehead BenWhitehead deleted the only-on-gen-config-change branch July 8, 2024 23:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api: storage Issues related to the googleapis/java-storage API. owlbot:ignore instruct owl-bot to ignore a PR size: xs Pull request size is extra small.

4 participants