-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
91 additions
and
2 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 |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# This workflow will do a clean install of node dependencies, build the source code and run tests across different versions of node | ||
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions | ||
|
||
name: CI | ||
|
||
on: | ||
pull_request: | ||
branches: [ master ] | ||
|
||
permissions: | ||
contents: write # to fetch code (actions/checkout) | ||
pull-requests: write | ||
|
||
jobs: | ||
update-docs: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: [16.x] | ||
|
||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Checkout PR | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
run: gh pr checkout ${{ github.event.pull_request.number }} | ||
|
||
- name: echo | ||
run: | | ||
set -x | ||
echo "${{ toJson(github.event) }}" | ||
echo ${{ github.event.pull_request.base.repo.full_name }} | ||
echo $GITHUB_REPOSITORY | ||
env | ||
- name: Fetch the master branch | ||
run: git fetch origin HEAD:refs/remotes/origin/HEAD --depth 1 | ||
- name: Fetch the master branch | ||
run: git diff --name-only origin/HEAD --no-renames --diff-filter=ACMR | ||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
- run: npm i | ||
# run linter | ||
- run: | | ||
set -x; | ||
git status; | ||
git checkout HEAD -- package.json; | ||
changes=$(git diff --name-only origin/HEAD --no-renames --diff-filter=ACMR); | ||
if [ "$changes" == "" ]; then | ||
echo "checking all files"; | ||
node node_modules/eslint/bin/eslint --fix "lib/ace/**/*.js"; | ||
else | ||
jsChanges=$(echo "$changes" | grep -P '.js$' || :); | ||
if [ "$jsChanges" == "" ]; then | ||
echo "nothing to check"; | ||
else | ||
echo "checking $jsChanges"; | ||
node node_modules/eslint/bin/eslint --fix $jsChanges; | ||
fi | ||
fi | ||
# check types | ||
- run: npm run update-types | ||
- run: node_modules/.bin/tsc --noImplicitAny --strict --noUnusedLocals --noImplicitReturns --noUnusedParameters --noImplicitThis ace.d.ts | ||
- run: npm run typecheck | ||
# push automatic fixes to the pull request | ||
- run: | | ||
set -x; | ||
git status; | ||
git add -u | ||
git reset -- build | ||
git config user.name "Ace Ci Bot" | ||
git config user.email "bot@c9.io" | ||
git commit -m "ci fixes" --author="Ace Ci Bot <bot@c9.io>" | ||
git branch -f CI_FIXES | ||
git remote -v | ||
git log --all --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit -- | head -n 100 | ||
- name: Push changes | ||
uses: ad-m/github-push-action@master | ||
with: | ||
github_token: ${{ secrets.GITHUB_TOKEN }} | ||
branch: ${{ github.ref }} |
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
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
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