Repository navigation
docs(CON-647): map the run sharing commands to the Console #6278
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: "+ Build Native Only" | ||
|
Check warning on line 1 in .github/workflows/build-native-only.yml
|
||
| on: | ||
| push: | ||
| branches: | ||
| - "**" | ||
| pull_request: | ||
| branches: [main] | ||
| types: [opened, synchronize, reopened] | ||
| release: | ||
| types: [created] | ||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.ref_name }}-${{ github.event.pull_request.number || github.sha }} | ||
| cancel-in-progress: true | ||
| jobs: | ||
| get-commit-message: | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| commit_message: ${{ steps.get-commit-message.outputs.commit_message }} | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 | ||
| with: | ||
| fetch-depth: 0 | ||
| - name: Get commit message | ||
| id: get-commit-message | ||
| shell: bash | ||
| env: | ||
| GITHUB_EVENT_NAME: ${{ github.event_name }} | ||
| PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} | ||
| HEAD_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | ||
| run: | | ||
| if [ "$GITHUB_EVENT_NAME" == "pull_request" ]; then | ||
| # For PR events, get the commit message from the PR head SHA | ||
| COMMIT_MESSAGE=$(git log -1 --format=%B "$PR_HEAD_SHA") | ||
| else | ||
| # For push events, use the head commit message | ||
| COMMIT_MESSAGE="$HEAD_COMMIT_MESSAGE" | ||
| fi | ||
| # Export for use in other steps (multiline-safe) | ||
| # Use printf with %s to avoid interpreting special characters | ||
| { | ||
| echo "commit_message<<EOF" | ||
| printf "%s\n" "$COMMIT_MESSAGE" | ||
| echo "EOF" | ||
| } >> $GITHUB_OUTPUT | ||
| check-trigger-condition: | ||
| runs-on: ubuntu-latest | ||
| needs: get-commit-message | ||
| permissions: | ||
| contents: read | ||
| outputs: | ||
| should_run: ${{ steps.check.outputs.should_run }} | ||
| steps: | ||
| - name: Check if workflow should run | ||
| id: check | ||
| env: | ||
| COMMIT_HAS_MARKER: ${{ contains(needs.get-commit-message.outputs.commit_message, 'build:native:only') }} | ||
| PR_HAS_MARKER: ${{ contains(github.event.pull_request.labels.*.name, 'build:native:only') }} | ||
| run: | | ||
| if [[ "$COMMIT_HAS_MARKER" == "true" ]] || \ | ||
| [[ "$PR_HAS_MARKER" == "true" ]]; then | ||
| echo "should_run=true" >> $GITHUB_OUTPUT | ||
| echo "✅ Workflow triggered: Found 'build:native:only' in commit message or PR labels" | ||
| else | ||
| echo "should_run=false" >> $GITHUB_OUTPUT | ||
| echo "⏭️ Workflow skipped: 'build:native:only' not found in commit message or PR labels" | ||
| fi | ||
| only_build_native: | ||
| needs: [get-commit-message, check-trigger-condition] | ||
| if: needs.check-trigger-condition.outputs.should_run == 'true' | ||
| uses: ./.github/workflows/_build-native-only.yml | ||
| permissions: | ||
| attestations: write | ||
| contents: write | ||
| id-token: write | ||
| packages: read | ||