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

Check for $BUILDKITE_PULL_REQUEST = false when uploading sarif file. #116

Merged
merged 4 commits into from
Sep 12, 2024

Conversation

wzieba
Copy link
Member

@wzieba wzieba commented Sep 12, 2024

If build is not associated with a pull request, Buildkite puts value false for $BUILDKITE_PULL_REQUEST
Initially, I thought it just doesn't create such variable.

Proof can be found here: https://buildkite.com/automattic/pocket-casts-android/builds/8308#0191e617-a1e2-4ae6-a7bb-4ef3dda51370

Because of this bug, after merge to trunk in Pocket Casts we can see:

{
  | [2024-09-12T12:07:17Z]   "message": "ref 'refs/pull/false/head' not found in this repository",
  | [2024-09-12T12:07:17Z]   "documentation_url": "https://docs.github.com/rest/code-scanning/code-scanning#upload-an-analysis-as-sarif-data",
  | [2024-09-12T12:07:17Z]   "status": "404"
  | [2024-09-12T12:07:17Z] 
}

  • I have considered if this change warrants release notes and have added them to the appropriate section in the CHANGELOG.md if necessary.

…`false` for `$BUILDKITE_PULL_REQUEST`

Initially, I thought it just doesn't create such variable.
@wzieba wzieba added the bug Something isn't working label Sep 12, 2024
bin/upload_sarif_to_github Outdated Show resolved Hide resolved
Comment on lines +54 to +55
else
exit 0
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

bin/upload_sarif_to_github Outdated Show resolved Hide resolved
Co-authored-by: Olivier Halligon <olivier.halligon@automattic.com>
@wzieba wzieba merged commit cbc848b into trunk Sep 12, 2024
14 checks passed
@wzieba wzieba deleted the send_sarif_reports_to_gh_fix_pull_request_env branch September 12, 2024 13:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants