Skip to content

Commit 16cb0fc

Browse files
authored
Merge pull request #132 from IShix-g/release
Release
2 parents 0fa45d2 + b389471 commit 16cb0fc

File tree

4 files changed

+43
-26
lines changed

4 files changed

+43
-26
lines changed

.github/actions/check-metas/action.yaml

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,13 @@ runs:
2525
shell: bash
2626
working-directory: ${{ inputs.directory }}
2727
run: |
28-
# Check for untracked or modified `.meta` files
2928
if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then
30-
echo "Detected uncommitted .meta file. Did you forget to commit a .meta file?"
31-
# Output meta-exists as true
29+
echo "::notice title=Check all meta::Detected uncommitted .meta file. Did you forget to commit a .meta file?"
3230
echo "meta-exists=true" | tee -a "$GITHUB_OUTPUT"
33-
# Exit with error if 'exit-on-error' is set to true
3431
if [[ "${{ inputs.exit-on-error }}" == "true" ]]; then
3532
exit 1
3633
fi
3734
else
38-
# If no .meta files are detected, display success message
39-
echo "::notice title=Check all .meta files::All .meta files are properly committed."
40-
# Output meta-exists as false
35+
echo "::notice title=Check all meta::All .meta files are properly committed."
4136
echo "meta-exists=false" | tee -a "$GITHUB_OUTPUT"
4237
fi

.github/workflows/build-package-exporter.yaml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ on:
1616
- '2021.3.45f1'
1717
- '2022.3.57f1'
1818
- '6000.0.37f1'
19+
include-default-branch:
20+
description: 'Include default branch in the action behavior. Set to true to include it.'
21+
type: boolean
22+
default: false
1923
dry-run:
2024
description: 'Dry Run: Set to true to simulate the merge without committing or pushing changes.'
2125
type: boolean
@@ -25,14 +29,24 @@ jobs:
2529
verify-branch:
2630
runs-on: ubuntu-22.04
2731
steps:
28-
- name: Check branch
32+
- name: Check if ref is default branch
2933
env:
3034
REF: ${{ github.ref }}
3135
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
3236
run: |
33-
CURRENT_REF=${REF#refs/heads/}
34-
if [ "$CURRENT_REF" = "$DEFAULT_BRANCH" ]; then
35-
echo "::error::Please specify a branch other than the default branch."
37+
include=${{ inputs.include-default-branch }}
38+
39+
if [ "$include" = 'true' ]; then
40+
exit 0
41+
fi
42+
43+
ref=${REF#refs/heads/}
44+
45+
if [ "$ref" = "$DEFAULT_BRANCH" ]; then
46+
echo "::error::Cannot proceed on default branch. ($DEFAULT_BRANCH)"
47+
echo "::error::If you want to target the default branch ($DEFAULT_BRANCH), please turn on 'Include default branch'."
48+
echo "Target branch: $ref"
49+
echo "Default branch: $DEFAULT_BRANCH"
3650
exit 1
3751
fi
3852

.github/workflows/build-release_merge.yaml

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,15 +37,25 @@ jobs:
3737
runs-on: ubuntu-22.04
3838
steps:
3939
- name: Check if ref is default branch
40-
if: ${{ !inputs.include-default-branch && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
40+
env:
41+
REF: ${{ github.ref }}
42+
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
4143
run: |
42-
target_branch="${{ github.ref }}"
43-
default_branch="${{ github.event.repository.default_branch }}"
44-
echo "::error::Cannot proceed on default branch. ($default_branch)"
45-
echo "::error::If you want to target the default branch ($default_branch), please turn on 'Include default branch'."
46-
echo "Target branch: $target_branch"
47-
echo "Default branch: $default_branch"
48-
exit 1
44+
include=${{ inputs.include-default-branch }}
45+
46+
if [ "$include" = 'true' ]; then
47+
exit 0
48+
fi
49+
50+
ref=${REF#refs/heads/}
51+
52+
if [ "$ref" = "$DEFAULT_BRANCH" ]; then
53+
echo "::error::Cannot proceed on default branch. ($DEFAULT_BRANCH)"
54+
echo "::error::If you want to target the default branch ($DEFAULT_BRANCH), please turn on 'Include default branch'."
55+
echo "Target branch: $ref"
56+
echo "Default branch: $DEFAULT_BRANCH"
57+
exit 1
58+
fi
4959
5060
update-packagejson:
5161
needs: [validate-branch]

.github/workflows/reusable-test-runner.yaml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ jobs:
9898
checkName: ${{ matrix.testMode }} Test Results
9999
coverageOptions: ${{ inputs.coverage-options }}
100100

101+
- uses: ./.github/actions/check-metas
102+
with:
103+
directory: ${{ inputs.project-path }}
104+
101105
- uses: actions/upload-artifact@v4
102106
if: always()
103107
with:
@@ -108,10 +112,4 @@ jobs:
108112
if: always()
109113
with:
110114
name: Coverage results for ${{ matrix.testMode }}
111-
path: ${{ steps.tests.outputs.coveragePath }}
112-
113-
check-metas:
114-
needs: test-all
115-
uses: ./.github/actions/check-metas
116-
with:
117-
directory: ${{ inputs.project-path }}
115+
path: ${{ steps.tests.outputs.coveragePath }}

0 commit comments

Comments
 (0)