post commit CI #1795
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
name: post commit CI | |
on: | |
push: | |
paths: | |
- scripts/**/*.js | |
- scripts/**/*.yaml | |
- "!scripts/test/*.js" | |
- "!scripts/generatePolyfill/*.js" | |
- "!scripts/detectHardcodedOutdatedNPMPackages/*.js" | |
- "!scripts/detectHardcodedOutdatedNPMPackages/*.yaml" | |
- "!scripts/autoAssign/*.js" | |
- src/**/*.js | |
- src/**/*.css | |
- src/**/definition.yaml | |
- src/gadgets/Gadgets-definition-list.yaml | |
- .github/workflows/postCommit.yaml | |
- .vscode/json-schemas/gadget-definition.json | |
- .browserslistrc | |
- .*.yaml | |
- package-lock.json | |
merge_group: | |
pull_request: | |
paths: | |
- scripts/**/*.js | |
- scripts/**/*.yaml | |
- "!scripts/test/*.js" | |
- "!scripts/generatePolyfill/*.js" | |
- "!scripts/detectHardcodedOutdatedNPMPackages/*.js" | |
- "!scripts/detectHardcodedOutdatedNPMPackages/*.yaml" | |
- "!scripts/autoAssign/*.js" | |
- src/**/*.js | |
- src/**/*.css | |
- src/**/definition.yaml | |
- src/gadgets/Gadgets-definition-list.yaml | |
- .github/workflows/postCommit.yaml | |
- .vscode/json-schemas/gadget-definition.json | |
- .browserslistrc | |
- .*.yaml | |
- package-lock.json | |
workflow_dispatch: | |
schedule: | |
- cron: 0 23 * * * # Every 07:00 CST | |
concurrency: | |
group: ${{ github.workflow_ref }}-${{ github.ref }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
permissions: | |
actions: read | |
checks: read | |
contents: write | |
deployments: read | |
issues: write | |
discussions: read | |
packages: read | |
pages: read | |
pull-requests: read | |
repository-projects: read | |
security-events: write | |
statuses: write | |
jobs: | |
skipCI: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
show-progress: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
check-latest: true | |
cache: npm | |
- name: Installing the dependencies | |
uses: AnnAngela/cached_node-modules@v2 | |
with: | |
command: npm run ci | |
- name: If needs to skip, skip now | |
run: node scripts/skip/index.js | |
id: skip | |
outputs: | |
skip: ${{ steps.skip.outputs.skip }} | |
postCommit: | |
runs-on: ubuntu-latest | |
needs: | |
- skipCI | |
if: always() && needs.skipCI.result == 'success' && needs.skipCI.outputs.skip != 'true' | |
steps: | |
- uses: actions/checkout@v4 | |
name: Checkout main repo | |
with: | |
fetch-depth: 0 | |
show-progress: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
check-latest: true | |
cache: npm | |
- name: Installing the dependencies | |
uses: AnnAngela/cached_node-modules@v2 | |
with: | |
command: npm run ci | |
- name: Git config | |
run: node scripts/postCommit/prepareGit.js | |
- name: Expose GitHub Runtime | |
uses: crazy-max/ghaction-github-runtime@v3 | |
- name: Auto browserify generator | |
run: node scripts/browserify/index.js | |
- name: Auto prefetch | |
run: node scripts/prefetch/index.js | |
- name: Gadgets-definition Generator | |
run: node scripts/generateGadgetsDefinition/index.js | |
- name: Conventional Commits scopes generator | |
run: node scripts/generateConventionalCommitsScopes/index.js | |
- name: Commits History generator | |
run: node scripts/generateCommitsHistory/index.js | |
- name: linguist-generated | |
run: node scripts/postCommit/linguist-generated.js | |
- name: Show git status & push | |
id: output | |
run: node scripts/postCommit/push.js | |
outputs: | |
commits: ${{ steps.output.outputs.commits }} | |
linterTest: ${{ steps.output.outputs.linterTest }} | |
linter_test: | |
runs-on: ubuntu-latest | |
needs: | |
- skipCI | |
- postCommit | |
if: always() && needs.skipCI.result == 'success' && needs.skipCI.outputs.skip != 'true' | |
env: | |
commits: ${{ needs.postCommit.outputs.commits }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
check-latest: true | |
cache: npm | |
- name: Installing the dependencies | |
uses: AnnAngela/cached_node-modules@v2 | |
with: | |
command: npm run ci | |
- name: Reload the linter cache | |
uses: actions/cache@v4 | |
with: | |
path: .cache | |
key: cache@${{ github.ref }} | |
- name: Check environment | |
run: 'npx eslint --env-info && echo ---- && echo "stylelint: "$(npx stylelint --version) && echo ---- && echo "v8r: "$(npx v8r --version) && echo ---- && mkdir -vp .cache && echo ".cache:" && ls -lhA .cache' | |
- name: Run eslint | |
run: npx eslint --cache --cache-strategy content --cache-location ".cache/" --exit-on-fatal-error --format @annangela/eslint-formatter-gha --max-warnings 0 ./src | |
- name: Run stylelint | |
run: npx stylelint --cache --cache-strategy content --cache-location ".cache/" --custom-formatter=stylelint-actions-formatters --max-warnings 0 "src/**/*.css" | |
- name: Run v8r | |
run: npx v8r | |
- name: Run postcss test | |
run: node scripts/postcss/index.js | |
- name: Check .mailmap | |
if: needs.postCommit.result == 'success' | |
run: node scripts/emailmapChecker/index.js | |
webhook: | |
runs-on: ubuntu-latest | |
needs: | |
- skipCI | |
- postCommit | |
- linter_test | |
if: always() && needs.skipCI.outputs.skip != 'true' && github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
show-progress: false | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
check-latest: true | |
cache: npm | |
- name: Installing the dependencies | |
uses: AnnAngela/cached_node-modules@v2 | |
with: | |
command: npm run ci | |
- name: Fire the webhook of AnnAngela's server | |
run: node scripts/fireWebhook/index.js | |
env: | |
needs: ${{ toJson(needs) }} | |
ANN_SERVER_SECRET_API_KEY: ${{ secrets.ANN_SERVER_SECRET_API_KEY }} |