diff --git a/.circleci/config.yml b/.circleci/config.yml index b39cd9d6365..dd0730e1671 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -17,8 +17,6 @@ references: environment: - GIT_COMMIT_DESC: git log --format=oneline -n 1 $CIRCLE_SHA1 # The public github tokens are publicly visible by design - - PUBLIC_PULLBOT_GITHUB_TOKEN_A: &github_pullbot_token_a "a6edf8e8d40ce4e8b11a" - - PUBLIC_PULLBOT_GITHUB_TOKEN_B: &github_pullbot_token_b "150e1341f4dd9c944d2a" - PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A: &github_analysisbot_token_a "312d354b5c36f082cfe9" - PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: &github_analysisbot_token_b "07973d757026bdd9f196" # Homebrew currently breaks while updating: @@ -36,8 +34,6 @@ references: # Repeated here, as the environment key in this executor will overwrite the one in defaults - PUBLIC_ANALYSISBOT_GITHUB_TOKEN_A: *github_analysisbot_token_a - PUBLIC_ANALYSISBOT_GITHUB_TOKEN_B: *github_analysisbot_token_b - - PUBLIC_PULLBOT_GITHUB_TOKEN_A: *github_pullbot_token_a - - PUBLIC_PULLBOT_GITHUB_TOKEN_B: *github_pullbot_token_b hermes_workspace_root: &hermes_workspace_root /tmp/hermes @@ -1914,7 +1910,7 @@ jobs: paths: - maven-local - # START: Commitlies + # START: Dry-run # Provide a react-native package for this commit as a Circle CI release artifact. - when: condition: @@ -1936,18 +1932,7 @@ jobs: root: . paths: - build/* - # END: Commitlies - - # START: Commits from pull requests - # When building commits from pull requests, leave a comment on the PR with a link to build artifacts - - when: - condition: - matches: { pattern: '^pull\/.*$', value: << pipeline.git.branch >> } - steps: - - run: - name: Post link to PR build artifacts (pull-bot) - command: GITHUB_TOKEN="$PUBLIC_PULLBOT_GITHUB_TOKEN_A""$PUBLIC_PULLBOT_GITHUB_TOKEN_B" scripts/circleci/post-artifacts-link.sh || true - # END: Commits from pull requests + # END: Dry-run # START: Stable releases - when: diff --git a/packages/react-native-bots/post-artifacts-link.js b/packages/react-native-bots/post-artifacts-link.js deleted file mode 100644 index 314f782b1a2..00000000000 --- a/packages/react-native-bots/post-artifacts-link.js +++ /dev/null @@ -1,86 +0,0 @@ -/** - * Copyright (c) Meta Platforms, Inc. and affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - */ - -'use strict'; - -const { - CIRCLE_BUILD_URL, - GITHUB_OWNER, - GITHUB_PR_NUMBER, - GITHUB_REPO, - GITHUB_SHA, - GITHUB_TOKEN, -} = process.env; - -const { - createOrUpdateComment, - validateEnvironment: validateEnvironmentForMakeComment, -} = require('./make-comment'); - -/** - * Creates or updates a comment with specified pattern. - * @param {{ auth: string; owner: string; repo: string; issue_number: string; }} params - * @param {string} buildURL link to circleCI build - * @param {string} commitSha github sha of PR - */ -function postArtifactLink(params, buildUrl, commitSha) { - // build url link is redirected by CircleCI so appending `/artifacts` doesn't work - const artifactLink = buildUrl; - const comment = [ - `PR build artifact${ - commitSha != null ? ` for ${commitSha}` : '' - } is ready.`, - `To use, download tarball from "Artifacts" tab in [this CircleCI job](${artifactLink}) then run \`yarn add \` in your React Native project.`, - ].join('\n'); - createOrUpdateComment(params, comment); -} - -/** - * Validates that required environment variables are set. - * @returns {boolean} `true` if everything is in order; `false` otherwise. - */ -function validateEnvironment() { - if ( - !validateEnvironmentForMakeComment() || - !CIRCLE_BUILD_URL || - !GITHUB_SHA - ) { - if (!GITHUB_SHA) { - console.error("Missing GITHUB_SHA. This should've been set by the CI."); - } - if (!CIRCLE_BUILD_URL) { - console.error( - "Missing CIRCLE_BUILD_URL. This should've been set by the CI.", - ); - } - return false; - } - - console.log(` GITHUB_SHA=${GITHUB_SHA}`); - console.log(` CIRCLE_BUILD_URL=${CIRCLE_BUILD_URL}`); - - return true; -} - -if (!validateEnvironment()) { - process.exit(1); -} - -try { - const params = { - auth: GITHUB_TOKEN, - owner: GITHUB_OWNER, - repo: GITHUB_REPO, - issue_number: GITHUB_PR_NUMBER, - }; - postArtifactLink(params, CIRCLE_BUILD_URL, GITHUB_SHA); -} catch (error) { - console.error(error); - process.exitCode = 1; -} diff --git a/scripts/circleci/post-artifacts-link.sh b/scripts/circleci/post-artifacts-link.sh deleted file mode 100755 index 21771e4fd49..00000000000 --- a/scripts/circleci/post-artifacts-link.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -# Copyright (c) Meta Platforms, Inc. and affiliates. -# -# This source code is licensed under the MIT license found in the -# LICENSE file in the root directory of this source tree. - -GITHUB_OWNER=${CIRCLE_PROJECT_USERNAME:-facebook} \ -GITHUB_REPO=${CIRCLE_PROJECT_REPONAME:-react-native} \ -GITHUB_PR_NUMBER="${CIRCLE_PR_NUMBER:-${CIRCLE_PULL_REQUEST##*/}}" \ -GITHUB_REF=${CIRCLE_BRANCH} \ -GITHUB_SHA=${CIRCLE_SHA1} \ -exec node packages/react-native-bots/post-artifacts-link.js