Skip to content

chore: fix security issue #2605

chore: fix security issue

chore: fix security issue #2605

Workflow file for this run

name: MAIN_PULL_REQUEST
on:
pull_request:
branches: [develop, main]
types: [opened, synchronize, reopened]
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: check_email
run: |
log_emails=$(git log --pretty=format:"%ae %ce" -1) && if [[ ${log_emails} =~ '@tencent.com' ]];then echo $log_emails && echo "邮箱校验非法" && exit 2;else echo "邮箱校验通过";fi
shell: bash
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
- uses: actions/cache@v2
env:
cache-name: cache-nodemodules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: npm install
- run: npm run lint
- run: npm run test
modify-web:
runs-on: ubuntu-latest
outputs:
web-changed: ${{ steps.web-changed.outputs.changed }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100
- uses: marceloprado/has-changed-path@v1
id: web-changed
with:
paths: style/web
modify-mobile:
runs-on: ubuntu-latest
outputs:
web-changed: ${{ steps.mobile-changed.outputs.changed }}
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 100
- uses: marceloprado/has-changed-path@v1
id: mobile-changed
with:
paths: style/mobile
build-web:
runs-on: ubuntu-latest
needs: modify-web
if: needs.modify-web.outputs.web-changed == 'true'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: Tencent/tdesign-vue
submodules: recursive
path: target-repo
- name: init site deploy
uses: actions/setup-node@v2
with:
node-version: 16
- run: |
cp -rf style/web/* target-repo/src/_common/style/web
cd target-repo/src/_common/
git diff
- uses: actions/cache@v2
env:
cache-name: cache-nodemodules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: |
cd target-repo/
npm install
npm run site:preview
echo ${{ github.event.number }} > ./_site/pr-id.txt
zip -r _site.zip _site
- name: upload artifact
uses: actions/upload-artifact@v2
with:
name: _site
path: target-repo/_site.zip
retention-days: 5
build-mobile:
runs-on: ubuntu-latest
needs: modify-mobile
if: needs.modify-mobile.outputs.mobile-changed == 'true'
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v2
with:
repository: Tencent/tdesign-mobile-vue
submodules: recursive
path: target-repo
- name: init site deploy
uses: actions/setup-node@v2
with:
node-version: 16
- run: |
cp -rf style/mobile/* target-repo/src/_common/style/mobile
cd target-repo/
git status
- uses: actions/cache@v2
env:
cache-name: cache-nodemodules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: |
cd target-repo/
npm install
npm run site:preview
echo ${{ github.event.number }} > ./_site/pr-id.txt
zip -r _site.zip _site
- name: upload artifact
uses: actions/upload-artifact@v2
with:
name: _site
path: target-repo/_site.zip
retention-days: 5