|
| 1 | +name: PR |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [opened, synchronize, edited] |
| 6 | + branches: [ "main", "*-stable", "release/*" ] |
| 7 | + |
| 8 | +concurrency: |
| 9 | + # Ensure single build of a pull request. `main` should not be affected. |
| 10 | + group: ${{ github.workflow }}-${{ github.ref }}-${{ github.head_ref || github.run_id }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + lint-commit: |
| 15 | + name: "Lint PR title" |
| 16 | + permissions: {} |
| 17 | + runs-on: ubuntu-latest |
| 18 | + steps: |
| 19 | + - uses: actions/checkout@v4 |
| 20 | + with: |
| 21 | + filter: blob:none |
| 22 | + fetch-depth: 0 |
| 23 | + - uses: actions/setup-node@v4 |
| 24 | + with: |
| 25 | + node-version: '22' |
| 26 | + # We lint the PR title instead of the commit message to avoid script injection attacks. |
| 27 | + # Using environment variables prevents potential security vulnerabilities as described in: |
| 28 | + # https://docs.github.com/en/actions/security-for-github-actions/security-guides/security-hardening-for-github-actions#example-of-a-script-injection-attack |
| 29 | + - name: Lint PR title |
| 30 | + env: |
| 31 | + PR_TITLE: ${{ github.event.pull_request.title }} |
| 32 | + run: | |
| 33 | + echo "$PR_TITLE" | npx @rnx-kit/[email protected] |
| 34 | + npm-publish-dry-run: |
| 35 | + name: "NPM Publish (Dry Run)" |
| 36 | + runs-on: ubuntu-24.04 |
| 37 | + env: |
| 38 | + PUBLISH_TAG: 'latest' |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + with: |
| 42 | + filter: blob:none |
| 43 | + fetch-depth: 0 |
| 44 | + - uses: actions/setup-node@v4 |
| 45 | + with: |
| 46 | + node-version: '22' |
| 47 | + - name: Configure git |
| 48 | + run: | |
| 49 | + git config --global user.email "[email protected]" |
| 50 | + git config --global user.name "React-Native Bot" |
| 51 | + git remote set-url origin https://rnbot:${{ secrets.GITHUB_TOKEN }}@github.com/microsoft/react-native-macos |
| 52 | + - name: Install dependencies |
| 53 | + run: yarn |
| 54 | + - name: Verify release config |
| 55 | + run: | |
| 56 | + node .ado/scripts/prepublish-check.mjs --verbose --tag ${{ env.PUBLISH_TAG }} |
| 57 | + - name: Version and publish packages (dry run) |
| 58 | + run: | |
| 59 | + echo "Target branch: ${{ github.base_ref }}" |
| 60 | + yarn nx release --dry-run --verbose |
0 commit comments