From 6d61899fc5d15859f7ceaf846ca66dbd83c1d003 Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Wed, 18 Sep 2024 02:57:48 -0700 Subject: [PATCH] Fix analyze_code to use the proper PR number (#46548) Summary: Analyze code was still using the CIRCLECI env variable to retrieve the PR number. This change uses the github one and also removes a duplicated flow check ## Changelog: [Internal] - Remove duplicated flow check and use gh PR number rather than CircleCI one Pull Request resolved: https://github.com/facebook/react-native/pull/46548 Test Plan: Tested locally and in CI Reviewed By: NickGerleman Differential Revision: D62883758 Pulled By: cipolleschi fbshipit-source-id: 0c7e97ea9caf4465972424e0b69a899ecfd07095 --- .github/actions/lint/action.yml | 1 + scripts/circleci/analyze_code.sh | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/actions/lint/action.yml b/.github/actions/lint/action.yml index 667b990029b..e914b6557b9 100644 --- a/.github/actions/lint/action.yml +++ b/.github/actions/lint/action.yml @@ -23,6 +23,7 @@ runs: run: yarn lint-ci env: GITHUB_TOKEN: ${{ inputs.github-token }} + GITHUB_PR_NUMBER: ${{ github.event.number }} - name: Lint code shell: bash run: ./scripts/circleci/exec_swallow_error.sh yarn lint --format junit -o ./reports/junit/eslint/results.xml diff --git a/scripts/circleci/analyze_code.sh b/scripts/circleci/analyze_code.sh index 96e42352155..8d4bb9d2561 100755 --- a/scripts/circleci/analyze_code.sh +++ b/scripts/circleci/analyze_code.sh @@ -9,7 +9,7 @@ GITHUB_REPO=${CIRCLE_PROJECT_REPONAME:-react-native} export GITHUB_OWNER export GITHUB_REPO -cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow-check --silent --json; echo flow; echo google-java-format; node scripts/lint-java.js --diff) | GITHUB_PR_NUMBER="$CIRCLE_PR_NUMBER" node packages/react-native-bots/code-analysis-bot.js +cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow-check --silent --json; echo google-java-format; node scripts/lint-java.js --diff) | node packages/react-native-bots/code-analysis-bot.js STATUS=$? if [ $STATUS == 0 ]; then