diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md index 6627967..9b2d570 100644 --- a/.github/pull_request_template.md +++ b/.github/pull_request_template.md @@ -6,6 +6,9 @@ + + + ## Expected Impact: 影響範囲 diff --git a/.github/workflows/add-version-tag.yml b/.github/workflows/add-version-tag.yml index 37e9ad9..e0facb7 100644 --- a/.github/workflows/add-version-tag.yml +++ b/.github/workflows/add-version-tag.yml @@ -7,9 +7,10 @@ on: name: Add version tag jobs: - release: + tag: + name: Add version tag runs-on: ubuntu-latest - if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/v') + if: github.event.pull_request.merged == true && startsWith(github.event.pull_request.head.ref, 'release/') steps: - name: Get version run: echo "::set-env name=TAG_NAME::${HEAD_REF#release/}" diff --git a/.github/workflows/check-version.yml b/.github/workflows/check-version.yml deleted file mode 100644 index 16b0475..0000000 --- a/.github/workflows/check-version.yml +++ /dev/null @@ -1,16 +0,0 @@ -on: push - -name: Check package version - -jobs: - checkVersion: - name: Check package version - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Check package version - uses: technote-space/package-version-check-action@v1 - with: - GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} - TEST_TAG_PREFIX: test/ - BRANCH_PREFIX: release/ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 32345e1..1dd8b04 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -141,22 +141,34 @@ jobs: matrix: target: ['npm'] steps: + - name: Set running flag + run: echo "::set-env name=RUNNING::1" + - name: Set running flag + run: | + if [ -z "$NPM_AUTH_TOKEN" ]; then + echo "::set-env name=RUNNING::" + fi + env: + NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} + - uses: actions/checkout@v2 + if: env.RUNNING - name: Setup Node.js uses: actions/setup-node@v1 with: node-version: 12 registry-url: https://registry.npmjs.org/ - if: matrix.target == 'npm' + if: env.RUNNING && matrix.target == 'npm' - name: Setup Node.js uses: actions/setup-node@v1 with: node-version: 12 registry-url: https://npm.pkg.github.com - if: matrix.target == 'gpr' + if: env.RUNNING && matrix.target == 'gpr' - name: Get Yarn Cache Directory id: yarn-cache run: echo "::set-output name=dir::$(yarn cache dir)" + if: env.RUNNING - name: Cache node dependencies uses: actions/cache@v1 with: @@ -164,34 +176,32 @@ jobs: key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }} restore-keys: | ${{ runner.os }}-yarn- - + if: env.RUNNING - name: Check package version uses: technote-space/package-version-check-action@v1 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} COMMIT_DISABLED: 1 + if: env.RUNNING - name: Install Package dependencies run: yarn install + if: env.RUNNING - name: Build run: yarn build + if: env.RUNNING - name: Publish run: | - if [ -n "$NPM_AUTH_TOKEN" ]; then - npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN - npm publish - fi + npm config set //registry.npmjs.org/:_authToken=$NPM_AUTH_TOKEN + npm publish env: NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - if: matrix.target == 'npm' + if: env.RUNNING && matrix.target == 'npm' - name: Publish run: | - if [ -n "$NPM_AUTH_TOKEN" ]; then - npm publish - fi + npm publish env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} - if: matrix.target == 'gpr' + if: env.RUNNING && matrix.target == 'gpr' - uses: 8398a7/action-slack@v2 with: status: failure diff --git a/.github/workflows/pr-opened.yml b/.github/workflows/pr-opened.yml index 731905a..418350b 100644 --- a/.github/workflows/pr-opened.yml +++ b/.github/workflows/pr-opened.yml @@ -33,3 +33,24 @@ jobs: uses: technote-space/pr-labeler-action@v3 with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + checkVersion: + name: Check package version + runs-on: ubuntu-latest + if: startsWith(github.event.pull_request.head.ref, 'release/') + steps: + - name: Set running flag + run: echo "::set-env name=RUNNING::1" + - uses: actions/checkout@v2 + - name: Set running flag + run: | + if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then + echo "::set-env name=RUNNING::" + fi + + - name: Check package version + uses: technote-space/package-version-check-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH_PREFIX: release/ + if: env.RUNNING diff --git a/.github/workflows/pr-updated.yml b/.github/workflows/pr-updated.yml index 4e8daf4..228d275 100644 --- a/.github/workflows/pr-updated.yml +++ b/.github/workflows/pr-updated.yml @@ -1,4 +1,6 @@ -on: pull_request +on: + pull_request: + types: [opened, synchronize] name: Pull Request updated @@ -6,16 +8,31 @@ jobs: triage: name: Pull Request Labeler runs-on: ubuntu-latest - if: "! startsWith(github.event.pull_request.head.ref, 'release/v')" + if: "! startsWith(github.event.pull_request.head.ref, 'release/')" steps: - name: Pull Request Labeler uses: actions/labeler@v2 with: repo-token: ${{ secrets.GITHUB_TOKEN }} + history: + name: Pull Request Body + runs-on: ubuntu-latest + if: startsWith(github.event.pull_request.head.ref, 'release/') + steps: + - name: Pull Request Body + uses: technote-space/pr-commit-body-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + EXCLUDE_MESSAGES: | + trigger workflow + Update TOC + Update package version + assignToProject: name: Assign PullRequest to Project runs-on: ubuntu-latest + if: github.event.action == 'synchronize' steps: - uses: actions/checkout@v2 - uses: technote-space/get-git-comment-action@v1 @@ -31,6 +48,7 @@ jobs: assignAuthor: name: Assign author to PR runs-on: ubuntu-latest + if: github.event.action == 'synchronize' steps: - uses: actions/checkout@v2 - uses: technote-space/get-git-comment-action@v1 @@ -44,6 +62,7 @@ jobs: addLabelsByBranch: name: PR Labeler runs-on: ubuntu-latest + if: github.event.action == 'synchronize' steps: - uses: actions/checkout@v2 - uses: technote-space/get-git-comment-action@v1 @@ -53,3 +72,29 @@ jobs: with: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} IGNORE_CONTEXT_CHECK: true + + checkVersion: + name: Check package version + runs-on: ubuntu-latest + if: github.event.action == 'synchronize' && startsWith(github.event.pull_request.head.ref, 'release/') + steps: + - name: Set running flag + run: echo "::set-env name=RUNNING::" + - uses: actions/checkout@v2 + - uses: technote-space/get-git-comment-action@v1 + - name: Set running flag + run: echo "::set-env name=RUNNING::1" + if: contains(env.COMMIT_MESSAGE, 'trigger workflow') + - name: Set running flag + run: | + if [[ ! -f package.json ]] || [[ $(< package.json jq -r '.version == null') == 'true' ]]; then + echo "::set-env name=RUNNING::" + fi + + - name: Check package version + uses: technote-space/package-version-check-action@v1 + with: + GITHUB_TOKEN: ${{ secrets.ACCESS_TOKEN }} + BRANCH_PREFIX: release/ + IGNORE_CONTEXT_CHECK: true + if: env.RUNNING