Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[PM-16076] [PM-16075] [PM-15126] [IGNORE] Contributor PR test #12422

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions .github/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Just a file to make this branch different from the main PM-15126 branch.
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,13 @@ apps/web/src/app/shared @bitwarden/team-platform-dev
apps/web/src/translation-constants.ts @bitwarden/team-platform-dev
# Workflows
.github/workflows/brew-bump-desktop.yml @bitwarden/team-platform-dev
.github/workflows/build-browser-target.yml @bitwarden/team-platform-dev
.github/workflows/build-browser.yml @bitwarden/team-platform-dev
.github/workflows/build-cli-target.yml @bitwarden/team-platform-dev
.github/workflows/build-cli.yml @bitwarden/team-platform-dev
.github/workflows/build-desktop-target.yml @bitwarden/team-platform-dev
.github/workflows/build-desktop.yml @bitwarden/team-platform-dev
.github/workflows/build-web-target.yml @bitwarden/team-platform-dev
.github/workflows/build-web.yml @bitwarden/team-platform-dev
.github/workflows/chromatic.yml @bitwarden/team-platform-dev
.github/workflows/lint.yml @bitwarden/team-platform-dev
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/build-browser-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build Browser on PR Target

on:
pull_request_target:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
- 'cf-pages'
paths:
- 'apps/browser/**'
- 'libs/**'
- '*'
- '!*.md'
- '!*.txt'
workflow_call:
inputs: {}
workflow_dispatch:
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
shell: bash

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

run-workflow:
name: Run Build Browser on PR Target
needs: check-run
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
uses: ./.github/workflows/build-browser.yml
secrets: inherit

22 changes: 21 additions & 1 deletion .github/workflows/build-browser.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build Browser

on:
pull_request_target:
pull_request:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
Expand Down Expand Up @@ -38,8 +38,27 @@ defaults:
shell: bash

jobs:
check-secrets:
name: Check Secrets
runs-on: ubuntu-22.04
outputs:
has_secrets: ${{ steps.check-secrets.outputs.has_secrets }}
steps:
- name: Check secrets
id: check-secrets
env:
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
run: |
has_secrets=${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL != '' }}
echo "has_secrets=$has_secrets" >> $GITHUB_OUTPUT

# Enforce permissions _if_ the workflow has access to secrets to avoid
# bots having unsupervised access to secrets.
check-run:
name: Check PR run
needs:
- check-secrets
if: ${{ needs.check-secrets.outputs.has_secrets == 'true' }}
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

setup:
Expand Down Expand Up @@ -281,6 +300,7 @@ jobs:
needs:
- setup
- locales-test
if: ${{ needs.setup.outputs.has_secrets == 'true' }}
env:
_BUILD_NUMBER: ${{ needs.setup.outputs.adj_build_number }}
_NODE_VERSION: ${{ needs.setup.outputs.node_version }}
Expand Down
39 changes: 39 additions & 0 deletions .github/workflows/build-cli-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Build CLI on PR Target

on:
pull_request_target:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
- 'cf-pages'
paths:
- 'apps/cli/**'
- 'libs/**'
- '*'
- '!*.md'
- '!*.txt'
- '.github/workflows/build-cli.yml'
- 'bitwarden_license/bit-cli/**'
workflow_dispatch:
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
shell: bash

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

run-workflow:
name: Run Build CLI on PR Target
needs: check-run
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
uses: ./.github/workflows/build-cli.yml
secrets: inherit

33 changes: 28 additions & 5 deletions .github/workflows/build-cli.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build CLI

on:
pull_request_target:
pull_request:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
Expand All @@ -27,6 +27,8 @@ on:
- '!*.txt'
- '.github/workflows/build-cli.yml'
- 'bitwarden_license/bit-cli/**'
workflow_call:
inputs: {}
workflow_dispatch:
inputs:
sdk_branch:
Expand All @@ -39,8 +41,27 @@ defaults:
working-directory: apps/cli

jobs:
check-secrets:
name: Check Secrets
runs-on: ubuntu-22.04
outputs:
has_secrets: ${{ steps.check-secrets.outputs.has_secrets }}
steps:
- name: Check secrets
id: check-secrets
env:
AZURE_KV_CI_SERVICE_PRINCIPAL: ${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL }}
run: |
has_secrets=${{ secrets.AZURE_KV_CI_SERVICE_PRINCIPAL != '' }}
echo "has_secrets=$has_secrets" >> $GITHUB_OUTPUT

# Enforce permissions _if_ the workflow has access to secrets to avoid
# bots having unsupervised access to secrets.
check-run:
name: Check PR run
needs:
- check-secrets
if: ${{ needs.check-secrets.outputs.has_secrets == 'true' }}
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

setup:
Expand Down Expand Up @@ -87,6 +108,7 @@ jobs:
]
runs-on: ${{ matrix.os.distro }}
needs:
- check-secrets
- setup
env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
Expand Down Expand Up @@ -117,7 +139,7 @@ jobs:
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && needs.check-secrets.outputs.has_secrets == 'true' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -130,7 +152,7 @@ jobs:
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && needs.check-secrets.outputs.` == 'true' }}
working-directory: ./
run: |
ls -l ../
Expand Down Expand Up @@ -187,6 +209,7 @@ jobs:
]
runs-on: windows-2022
needs:
- check-secrets
- setup
env:
_PACKAGE_VERSION: ${{ needs.setup.outputs.package_version }}
Expand Down Expand Up @@ -272,7 +295,7 @@ jobs:
working-directory: ./

- name: Download SDK Artifacts
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && needs.check-secrets.outputs.has_secrets == 'true' }}
uses: bitwarden/gh-actions/download-artifacts@main
with:
github_token: ${{secrets.GITHUB_TOKEN}}
Expand All @@ -285,7 +308,7 @@ jobs:
if_no_artifact_found: fail

- name: Override SDK
if: ${{ inputs.sdk_branch != '' }}
if: ${{ inputs.sdk_branch != '' && needs.check-secrets.outputs.has_secrets == 'true' }}
working-directory: ./
run: |
ls -l ../
Expand Down
38 changes: 38 additions & 0 deletions .github/workflows/build-desktop-target.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Build Desktop on PR Target

on:
pull_request_target:
types: [opened, synchronize]
branches-ignore:
- 'l10n_master'
- 'cf-pages'
paths:
- 'apps/desktop/**'
- 'libs/**'
- '*'
- '!*.md'
- '!*.txt'
- '.github/workflows/build-desktop.yml'
workflow_dispatch:
inputs:
sdk_branch:
description: "Custom SDK branch"
required: false
type: string

defaults:
run:
shell: bash

jobs:
check-run:
name: Check PR run
uses: bitwarden/gh-actions/.github/workflows/check-run.yml@main

run-workflow:
name: Run Build Desktop on PR Target
needs: check-run
if: ${{ github.event.pull_request.head.repo.full_name != github.repository }}
uses: ./.github/workflows/build-desktop.yml
secrets: inherit

Loading
Loading