Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 2 additions & 7 deletions .github/actions/check-metas/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,13 @@ runs:
shell: bash
working-directory: ${{ inputs.directory }}
run: |
# Check for untracked or modified `.meta` files
if git ls-files --others --exclude-standard -t | grep --regexp='[.]meta$'; then
echo "Detected uncommitted .meta file. Did you forget to commit a .meta file?"
# Output meta-exists as true
echo "::notice title=Check all meta::Detected uncommitted .meta file. Did you forget to commit a .meta file?"
echo "meta-exists=true" | tee -a "$GITHUB_OUTPUT"
# Exit with error if 'exit-on-error' is set to true
if [[ "${{ inputs.exit-on-error }}" == "true" ]]; then
exit 1
fi
else
# If no .meta files are detected, display success message
echo "::notice title=Check all .meta files::All .meta files are properly committed."
# Output meta-exists as false
echo "::notice title=Check all meta::All .meta files are properly committed."
echo "meta-exists=false" | tee -a "$GITHUB_OUTPUT"
fi
22 changes: 18 additions & 4 deletions .github/workflows/build-package-exporter.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ on:
- '2021.3.45f1'
- '2022.3.57f1'
- '6000.0.37f1'
include-default-branch:
description: 'Include default branch in the action behavior. Set to true to include it.'
type: boolean
default: false
dry-run:
description: 'Dry Run: Set to true to simulate the merge without committing or pushing changes.'
type: boolean
Expand All @@ -25,14 +29,24 @@ jobs:
verify-branch:
runs-on: ubuntu-22.04
steps:
- name: Check branch
- name: Check if ref is default branch
env:
REF: ${{ github.ref }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
CURRENT_REF=${REF#refs/heads/}
if [ "$CURRENT_REF" = "$DEFAULT_BRANCH" ]; then
echo "::error::Please specify a branch other than the default branch."
include=${{ inputs.include-default-branch }}

if [ "$include" = 'true' ]; then
exit 0
fi

ref=${REF#refs/heads/}

if [ "$ref" = "$DEFAULT_BRANCH" ]; then
echo "::error::Cannot proceed on default branch. ($DEFAULT_BRANCH)"
echo "::error::If you want to target the default branch ($DEFAULT_BRANCH), please turn on 'Include default branch'."
echo "Target branch: $ref"
echo "Default branch: $DEFAULT_BRANCH"
exit 1
fi

Expand Down
26 changes: 18 additions & 8 deletions .github/workflows/build-release_merge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,25 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Check if ref is default branch
if: ${{ !inputs.include-default-branch && github.ref == format('refs/heads/{0}', github.event.repository.default_branch) }}
env:
REF: ${{ github.ref }}
DEFAULT_BRANCH: ${{ github.event.repository.default_branch }}
run: |
target_branch="${{ github.ref }}"
default_branch="${{ github.event.repository.default_branch }}"
echo "::error::Cannot proceed on default branch. ($default_branch)"
echo "::error::If you want to target the default branch ($default_branch), please turn on 'Include default branch'."
echo "Target branch: $target_branch"
echo "Default branch: $default_branch"
exit 1
include=${{ inputs.include-default-branch }}

if [ "$include" = 'true' ]; then
exit 0
fi

ref=${REF#refs/heads/}

if [ "$ref" = "$DEFAULT_BRANCH" ]; then
echo "::error::Cannot proceed on default branch. ($DEFAULT_BRANCH)"
echo "::error::If you want to target the default branch ($DEFAULT_BRANCH), please turn on 'Include default branch'."
echo "Target branch: $ref"
echo "Default branch: $DEFAULT_BRANCH"
exit 1
fi

update-packagejson:
needs: [validate-branch]
Expand Down
12 changes: 5 additions & 7 deletions .github/workflows/reusable-test-runner.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ jobs:
checkName: ${{ matrix.testMode }} Test Results
coverageOptions: ${{ inputs.coverage-options }}

- uses: ./.github/actions/check-metas
with:
directory: ${{ inputs.project-path }}

- uses: actions/upload-artifact@v4
if: always()
with:
Expand All @@ -108,10 +112,4 @@ jobs:
if: always()
with:
name: Coverage results for ${{ matrix.testMode }}
path: ${{ steps.tests.outputs.coveragePath }}

check-metas:
needs: test-all
uses: ./.github/actions/check-metas
with:
directory: ${{ inputs.project-path }}
path: ${{ steps.tests.outputs.coveragePath }}
Loading