-
-
Notifications
You must be signed in to change notification settings - Fork 14
49 lines (46 loc) · 1.87 KB
/
add-test-tag.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
on:
pull_request:
types: [synchronize]
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
name: Add test tag
jobs:
tag:
name: Add test tag
runs-on: ubuntu-latest
timeout-minutes: 3
if: github.event.pull_request.head.user.id == github.event.pull_request.base.user.id && startsWith(github.head_ref, 'release/')
steps:
- uses: technote-space/load-config-action@v1
with:
CONFIG_FILENAME: workflow-settings.json, workflow-details.json
IGNORE_WARNING: 'true'
- uses: actions/checkout@v3
- uses: technote-space/get-git-comment-action@v1
- name: Get version
uses: technote-space/get-next-version-action@v1
with:
EXCLUDE_MESSAGES: ${{ env.EXCLUDE_MESSAGES }}
if: "! startsWith(github.head_ref, 'release/v') && (contains(env.COMMIT_MESSAGE, 'chore: update dependencies') || contains(env.COMMIT_MESSAGE, 'chore: update npm dependencies'))"
- name: Get version
run: echo "NEXT_VERSION=${HEAD_REF#release/}" >> $GITHUB_ENV
env:
HEAD_REF: ${{ github.head_ref }}
if: "startsWith(github.head_ref, 'release/v') && (contains(env.COMMIT_MESSAGE, 'chore: update dependencies') || contains(env.COMMIT_MESSAGE, 'chore: update npm dependencies'))"
- name: Get tag name
run: echo "TAG_NAME=${NEXT_VERSION}.${RUN_ID}" >> $GITHUB_ENV
env:
HEAD_REF: ${{ github.head_ref }}
RUN_ID: ${{ github.run_id }}
if: env.NEXT_VERSION
- uses: actions/github-script@v3
with:
github-token: ${{ secrets.ACCESS_TOKEN }}
script: |
github.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: `refs/tags/test/${process.env.TAG_NAME}`,
sha: context.payload.pull_request.head.sha
})
if: env.TAG_NAME