forked from facebook/react-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix eslint code analysis bot (facebook#20822)
Summary: The eslint bot has not been working since the migration to Circle 2.0. Pull Request resolved: facebook#20822 Differential Revision: D9492680 Pulled By: hramos fbshipit-source-id: 7f2f9ac125b6cab1750902c485a6d27d6c3cf302
- Loading branch information
1 parent
e4621f4
commit 1fe7b40
Showing
3 changed files
with
61 additions
and
66 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -541,45 +541,44 @@ jobs: | |
# Issues will be posted to the PR itself via GitHub bots. | ||
# This workflow should only fail if the bots fail to run. | ||
analyze_pr: | ||
<<: *js_defaults | ||
<<: *defaults | ||
docker: | ||
- image: circleci/node:10 | ||
environment: | ||
- PATH: "/opt/yarn/yarn-v1.5.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" | ||
steps: | ||
- attach_workspace: | ||
at: ~/react-native | ||
- checkout | ||
- run: *setup-artifacts | ||
|
||
- restore-cache: *restore-cache-analysis | ||
- restore-cache: *restore-yarn-cache | ||
- run: *yarn | ||
|
||
- run: | ||
name: Install Additional Dependencies | ||
name: Analyze Code | ||
command: | | ||
# GITHUB_TOKEN=eslint-bot public_repo access token | ||
if [ -n "$CIRCLE_PR_NUMBER" ]; then | ||
yarn add [email protected] | ||
cd bots | ||
yarn install --non-interactive --cache-folder ~/.cache/yarn | ||
echo -e "\\x1B[36mInstalling additional dependencies\\x1B[0m"; yarn add @octokit/[email protected] | ||
echo -e "\\x1B[36mAnalyzing code\\x1B[0m"; GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" ./scripts/circleci/analyze_code.sh | ||
else | ||
echo "Skipping dependency installation." | ||
echo "Skipping code analysis." | ||
fi | ||
- save-cache: *save-cache-analysis | ||
when: always | ||
|
||
- restore-cache: *restore-cache-analysis | ||
- run: | ||
name: Analyze Pull Request | ||
command: | | ||
# DANGER_GITHUB_API_TOKEN=React-Linter public_repo access token | ||
if [ -n "$CIRCLE_PR_NUMBER" ]; then | ||
cd bots && DANGER_GITHUB_API_TOKEN="80aa64c50f38a267e9ba""575d41d528f9c234edb8" yarn danger | ||
cd bots | ||
yarn install --non-interactive --cache-folder ~/.cache/yarn | ||
DANGER_GITHUB_API_TOKEN="80aa64c50f38a267e9ba""575d41d528f9c234edb8" yarn danger | ||
else | ||
echo "Skipping pull request analysis." | ||
fi | ||
when: always | ||
- run: | ||
name: Analyze Code | ||
command: | | ||
# GITHUB_TOKEN=eslint-bot public_repo access token | ||
if [ -n "$CIRCLE_PR_NUMBER" ]; then | ||
GITHUB_TOKEN="af6ef0d15709bc91d""06a6217a5a826a226fb57b7" CI_USER=$CIRCLE_PROJECT_USERNAME CI_REPO=$CIRCLE_PROJECT_REPONAME PULL_REQUEST_NUMBER=$CIRCLE_PR_NUMBER scripts/circleci/analyze_code.sh | ||
else | ||
echo "Skipping code analysis." | ||
fi | ||
when: always | ||
- save-cache: *save-cache-analysis | ||
|
||
# Publishes new version onto npm | ||
# Only works on stable branches when a properly tagged commit is pushed | ||
|
@@ -686,15 +685,6 @@ workflows: | |
- test_objc | ||
- test_android | ||
|
||
# Only runs on PRs | ||
analyze: | ||
jobs: | ||
# Checkout repo and run Yarn | ||
- checkout_code: | ||
filters: *filter-ignore-master-stable | ||
|
||
# Run code checks | ||
- analyze_pr: | ||
filters: *filter-ignore-master-stable | ||
requires: | ||
- checkout_code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,11 @@ | ||
#!/bin/bash | ||
|
||
cat <(echo eslint; yarn --silent lint --format=json; echo flow; yarn --silent flow check --json) | GITHUB_TOKEN=$GITHUB_TOKEN CI_USER=$CI_USER CI_REPO=$CI_REPO PULL_REQUEST_NUMBER=$PULL_REQUEST_NUMBER node bots/code-analysis-bot.js | ||
cat <(echo eslint; npm run lint --silent -- --format=json; echo flow; npm run flow --silent -- check --json) | node scripts/circleci/code-analysis-bot.js | ||
|
||
# check status | ||
STATUS=$? | ||
if [ $STATUS == 0 ]; then | ||
echo "Code analyzed successfully" | ||
else | ||
echo "Code analyzis failed, error status $STATUS" | ||
echo "Code analysis failed, error status $STATUS" | ||
fi | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters