me

GitHub Action MetaData


创建 action 和使用 workflows 是两个不同的操作

JavaScript 操作

GitHub Actions 的元数据语法

name: 'test one create issues'
description: 'test create issues'
inputs:
  token:
    description: 'ACTION_ACCESS'
    required: true
    default: ${{github.token}}
  repoURL:
    description: 'repo'
    default: ${{github.repositoryUrl}}
  path:
    description: 'path'
    default: ${{github.action_path}}
runs:
  using: 'node16'
  main: 'index.mjs'

编写 index.js 文件

编写工作流 workflows

on: [push]

jobs:
  test_one_issues:
    runs-on: ubuntu-latest
    name: create issues action
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: node
        uses: actions/setup-node@v3.0.0
        with:
          node-version: "16.x"
      - name: install
        run: npm install
      - name: create issues
        uses: ./
        with:
          token: ${{secrets.ACTION_ACCESS}}

如果只想打包 dist 文件到仓库,可以使用 @vercel/ncc 这个包,这个包只会把引用的模块加载到 dist 包中