Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: IABTechLab/uid2-shared-actions
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.3.2
Choose a base ref
...
head repository: IABTechLab/uid2-shared-actions
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref

Commits on Dec 6, 2023

  1. Copy the full SHA
    1132706 View commit details
  2. Merge pull request #30 from IABTechLab/llp-uid2-2236-auto-pr-action

    Add support for creating tags.
    lionell-pack-ttd authored Dec 6, 2023
    Copy the full SHA
    01e9c02 View commit details
  3. Copy the full SHA
    dcdfe9a View commit details

Commits on Dec 7, 2023

  1. Merge pull request #31 from IABTechLab/llp-uid2-2236-auto-pr-action

    Add support for specifying paths to add.
    lionell-pack-ttd authored Dec 7, 2023
    Copy the full SHA
    d887dc0 View commit details
  2. Copy the full SHA
    90a5047 View commit details
  3. Copy the full SHA
    14092d0 View commit details
  4. Copy the full SHA
    6899505 View commit details
  5. Copy the full SHA
    0773993 View commit details
  6. Set to critical only

    thomasm-ttd committed Dec 7, 2023
    Copy the full SHA
    eefbaf2 View commit details
  7. Copy the full SHA
    d2cf9a7 View commit details
  8. Merge pull request #32 from IABTechLab/gdm-UID2-988-package-jar-skip-…

    …tests
    
    UID2-988 - Added skip_tests option for package JAR
    gmsdelmundo authored Dec 7, 2023
    Copy the full SHA
    256ac19 View commit details

Commits on Dec 8, 2023

  1. Make levels inputs

    thomasm-ttd committed Dec 8, 2023
    Copy the full SHA
    3f0fa48 View commit details
  2. Moved the vulnerability scanning to use the action

    Deleted some unused workflows
    thomasm-ttd committed Dec 8, 2023
    Copy the full SHA
    3c7c4a5 View commit details
  3. Copy the full SHA
    ad99f7d View commit details
  4. Merge pull request #33 from IABTechLab/tjm-UID2-2343-add-trivy-scanni…

    …ng-action
    
    UID2-2343 Add Trivy scanning action
    thomasm-ttd authored Dec 8, 2023
    Copy the full SHA
    1f5d1bf View commit details
  5. Copy the full SHA
    82e37c1 View commit details

Commits on Dec 11, 2023

  1. Merge remote-tracking branch 'origin/main' into llp-uid2-2236-auto-pr…

    …-action
    
    # Conflicts:
    #	.github/workflows/shared-java-publish-versioned-package.yaml
    #	.github/workflows/shared-release-major-minor-patch.yaml
    lionell-pack-ttd committed Dec 11, 2023
    Copy the full SHA
    e1949eb View commit details
  2. Copy the full SHA
    dc7e869 View commit details
  3. Merge pull request #34 from IABTechLab/llp-uid2-2236-auto-pr-action

    Use a PR-based workflow instead of committing directly to main
    lionell-pack-ttd authored Dec 11, 2023
    Copy the full SHA
    a4d2dde View commit details
  4. Move to using a script action to create the PR.

    Create a test workflow for ... testing.
    lionell-pack-ttd committed Dec 11, 2023
    Copy the full SHA
    21fbdf6 View commit details

Commits on Dec 13, 2023

  1. Test code update.

    lionell-pack-ttd committed Dec 13, 2023
    Copy the full SHA
    47aaae4 View commit details
  2. Bump version.

    lionell-pack-ttd committed Dec 13, 2023
    Copy the full SHA
    3b4e635 View commit details
  3. Copy the full SHA
    163a27d View commit details
  4. Copy the full SHA
    4d0eedb View commit details
  5. Make add required.

    lionell-pack-ttd committed Dec 13, 2023
    Copy the full SHA
    68abda9 View commit details
  6. Copy the full SHA
    be56c6e View commit details
  7. Merge pull request #36 from IABTechLab/kcc-UID2-2338-add-script-file

    Add docker-build-public.sh file
    cYKatherine authored Dec 13, 2023
    Copy the full SHA
    0d6b792 View commit details
  8. Copy the full SHA
    336c283 View commit details

Commits on Dec 15, 2023

  1. Copy the full SHA
    f4fdfab View commit details
  2. Merge pull request #39 from IABTechLab/llp-uid2-2236-auto-pr-action

    UID2-2236 Change our commit-pr-merge action to fit in with available permissions.
    lionell-pack-ttd authored Dec 15, 2023
    Copy the full SHA
    29f8dc5 View commit details
  3. Copy the full SHA
    69dcd63 View commit details
  4. Merge pull request #40 from IABTechLab/llp-uid2-2236-auto-pr-action

    Revert change to add format.
    lionell-pack-ttd authored Dec 15, 2023
    Copy the full SHA
    41e0349 View commit details
  5. Add actions for running e2e tests (#35)

    * Add actions for running e2e tests
    
    * Move the whole e2e workflow to shared
    
    * Move docker-compose file to uid2-e2e repo
    
    * Add `uid2_e2e_phone_support` as inputs
    
    * Cat out config files
    
    * Use docker pull/push command directly instead of addnab/docker-run-action@v3
    
    * Move script to a separate folder and rename it
    
    * Replace the default latest version with the provided version
    
    * Pass in operator type when doing docker compose
    
    * Remove `secrets.GHCR_PAT`
    
    * Add branch name as an input
    
    * Add step for checkingout UID2-operator
    
    * Set default image version for core and optout to be latest
    
    * Remove branch tags
    cYKatherine authored Dec 15, 2023
    Copy the full SHA
    69d0b89 View commit details
  6. Copy the full SHA
    a85589d View commit details
  7. Copy the full SHA
    94a2a1a View commit details
  8. Merge pull request #42 from IABTechLab/llp-uid2-2236-auto-pr-action

    Request PR write permissions.
    lionell-pack-ttd authored Dec 15, 2023
    Copy the full SHA
    302892e View commit details
  9. Copy the full SHA
    cbc5f69 View commit details
  10. Merge pull request #43 from IABTechLab/llp-uid2-2236-auto-pr-action

    Move PR permission to the right place.
    lionell-pack-ttd authored Dec 15, 2023
    Copy the full SHA
    8f231ec View commit details

Commits on Dec 18, 2023

  1. Add tag to release note generation step.

    Add permission requests for Java build job.
    lionell-pack-ttd committed Dec 18, 2023
    Copy the full SHA
    1f47442 View commit details
  2. Merge pull request #44 from IABTechLab/llp-uid2-2236-set-tag-for-chan…

    …gelog
    
    Add tag to release note generation step.
    lionell-pack-ttd authored Dec 18, 2023
    Copy the full SHA
    8f6de3f View commit details
  3. Fix ID

    lionell-pack-ttd committed Dec 18, 2023
    Copy the full SHA
    bdfe8b9 View commit details
  4. Copy the full SHA
    cc3c392 View commit details
  5. Update Java shared action.

    Remove unneeded conditional in docker action.
    lionell-pack-ttd committed Dec 18, 2023
    Copy the full SHA
    2665b3c View commit details
  6. Merge pull request #46 from IABTechLab/llp-uid2-2236-set-tag-for-chan…

    …gelog
    
    Update Java shared action.
    lionell-pack-ttd authored Dec 18, 2023
    Copy the full SHA
    a279183 View commit details

Commits on Dec 19, 2023

  1. Customise working dir which has pom.xml and version.json (#47)

    * Customise pom.xml path
    
    * Customise version.json path
    
    * Use working dir
    
    * Use v2 version
    cYKatherine authored Dec 19, 2023
    Copy the full SHA
    52d9f08 View commit details

Commits on Jan 9, 2024

  1. UID2-2339 create test pipeline for gcp (#48)

    * Set up bore
    
    * Add core, localstack and optout bore url
    
    * Add steps to start GCP private operator
    
    * Run docker compose up before starting gcp private operator
    
    * Fix typo for bore localhost
    
    * Replace config files with bore urls
    
    * Change localhost name to localhost for bore
    
    * Add stop gcp instance step
    
    * Test
    
    * Self host a bore server
    
    * Revert jq replacing
    
    * Fix ampersand operator
    
    * Use bore.pub
    
    * Test different steps
    
    * Test spinning up GCP instance
    
    * Use docker to run bore
    
    * Add `http://` prefix
    
    * Rename `prepare_resources_for_e2e_docker_compose.sh`
    
    * Use sha256 hash for operator image
    
    * Login to GCP registry
    
    * Authenticate with Google Cloud first
    
    * Add http protocol for bore.pub
    
    * Separate `prepare_gcp_metadata` and `start_gcp_private_operator`
    
    * Override value for `enforce_https`
    
    * Remove stop gcp instances code from starting script
    
    * Add steps to run E2E tests for private operator
    
    * Do not pass in env var as inputs
    
    * Do not replace base url for public operator
    
    * Create docker network as a step
    
    * Use enum value for cloud provider
    
    * Add condition when stopping gcp operator instances
    
    * Remove public check condition for checking env vars
    
    * Add wrong if statement to test dockerfile change
    
    * Revert test if statement
    
    * Remove required constraint on gcp specific inputs
    
    * Rename jq_helper to meaningful names
    
    * Move gcp specific scripts to a separate folder
    
    * Update version to v2
    cYKatherine authored Jan 9, 2024
    Copy the full SHA
    cc61951 View commit details
  2. Capitalise E2E (#49)

    cYKatherine authored Jan 9, 2024
    Copy the full SHA
    81b5dce View commit details

Commits on Jan 10, 2024

  1. Copy the full SHA
    937f120 View commit details

Commits on Jan 12, 2024

  1. Copy the full SHA
    914fad8 View commit details
  2. Merge pull request #51 from IABTechLab/llp-uid2-2573-update-major-ver…

    …sion-tags
    
    Update latest major version tag whenever a production release is created.
    lionell-pack-ttd authored Jan 12, 2024
    Copy the full SHA
    e6fdc27 View commit details
Showing with 4,521 additions and 706 deletions.
  1. +9 −0 .github/workflows/build-and-test.yaml
  2. +47 −31 .github/workflows/shared-build-and-test.yaml
  3. +1 −1 .github/workflows/shared-check-stable-dependency.yaml
  4. +92 −0 .github/workflows/shared-increase-version-number.yaml
  5. +0 −133 .github/workflows/shared-java-publish-versioned-package.yaml
  6. +34 −0 .github/workflows/shared-promote-auto-pr.yaml
  7. +0 −114 .github/workflows/shared-publish-image-aws-ecr.yaml
  8. +62 −58 ...b/workflows/{shared-publish-docker-versioned.yaml → shared-publish-java-to-docker-versioned.yaml}
  9. +87 −0 .github/workflows/shared-publish-to-docker-versioned.yaml
  10. +104 −0 .github/workflows/shared-publish-to-ios-version.yaml
  11. +175 −0 .github/workflows/shared-publish-to-maven-versioned.yaml
  12. +124 −0 .github/workflows/shared-publish-to-nuget-versioned.yaml
  13. +112 −0 .github/workflows/shared-publish-to-pypi-versioned.yaml
  14. +0 −113 .github/workflows/shared-release-major-minor-patch.yaml
  15. +384 −0 .github/workflows/shared-run-e2e-tests.yaml
  16. +27 −45 .github/workflows/shared-validate-image.yaml
  17. +115 −0 .github/workflows/shared-vulnerability-scan-failure-notify.yaml
  18. +0 −43 .github/workflows/shared-vulnerability-scanning.yaml
  19. +15 −0 .github/workflows/update-major-version-tags.yaml
  20. +23 −0 .github/workflows/vulnerability-scan-failure-notify.yaml
  21. +2 −1 .gitignore
  22. +5 −0 .trivyignore
  23. +6 −0 README.md
  24. +0 −79 actions/build_scan_image/action.yaml
  25. +4 −4 actions/check_branch_and_release_type/action.yaml
  26. +0 −39 actions/check_version/action.yaml
  27. +0 −25 actions/commit-pr-and-merge/action.yaml
  28. +135 −0 actions/commit_pr_and_merge/action.yaml
  29. +35 −0 actions/delete_draft_releases/action.yaml
  30. +1 −0 actions/download_gpg_key/action.yaml
  31. +57 −0 actions/prepare_aks_metadata/action.yaml
  32. +42 −0 actions/prepare_aws_metadata/action.yaml
  33. +52 −0 actions/prepare_azure_metadata/action.yaml
  34. +92 −0 actions/prepare_gcp_metadata/action.yaml
  35. +103 −0 actions/run_e2e_tests/action.yaml
  36. +73 −0 actions/shared_create_releases/action.yaml
  37. +70 −0 actions/shared_publish_setup/action.yaml
  38. +102 −0 actions/shared_publish_to_docker/action.yaml
  39. +33 −0 actions/start_aks_private_operator/action.yaml
  40. +73 −0 actions/start_aws_private_operator/action.yaml
  41. +52 −0 actions/start_azure_private_operator/action.yaml
  42. +47 −0 actions/start_gcp_private_operator/action.yaml
  43. +22 −0 actions/stop_aks_private_operator/action.yaml
  44. +30 −0 actions/stop_aws_private_operator/action.yaml
  45. +27 −0 actions/stop_azure_private_operator/action.yaml
  46. +51 −0 actions/stop_gcp_private_operator/action.yaml
  47. +81 −0 actions/update-major-version-tag/action.yaml
  48. +35 −20 actions/version_number/action.yaml
  49. +133 −0 actions/vulnerability_scan/action.yaml
  50. +58 −0 scripts/aks/add_env.py
  51. +118 −0 scripts/aks/prepare_aks_artifacts.sh
  52. +20 −0 scripts/aks/prepare_aks_enclave_id.sh
  53. +45 −0 scripts/aks/start_aks_enclave.sh
  54. +13 −0 scripts/aks/stop_aks_enclave.sh
  55. +89 −0 scripts/aws/create_cloudformation_stack.py
  56. +26 −0 scripts/aws/get_instance_url.py
  57. +6 −0 scripts/aws/requirements.txt
  58. +7 −0 scripts/aws/stacks/stack.ca-central-1.json
  59. +7 −0 scripts/aws/stacks/stack.eu-central-1.json
  60. +7 −0 scripts/aws/stacks/stack.us-east-1.json
  61. +7 −0 scripts/aws/stacks/stack.us-west-1.json
  62. +97 −0 scripts/aws/start_aws_enclave.sh
  63. +16 −0 scripts/aws/stop_aws_enclave.sh
  64. +33 −0 scripts/azure/artifacts_schema/parameters.json
  65. +173 −0 scripts/azure/artifacts_schema/template.json
  66. +67 −0 scripts/azure/prepare_azure_artifacts.sh
  67. +20 −0 scripts/azure/prepare_azure_enclave_id.sh
  68. +93 −0 scripts/azure/start_azure_enclave.sh
  69. +13 −0 scripts/azure/stop_azure_enclave.sh
  70. +83 −0 scripts/compile_java_test_and_verify.sh
  71. +102 −0 scripts/decide_e2e_env.sh
  72. +21 −0 scripts/gcp/prepare_gcp_enclave_id.sh
  73. +81 −0 scripts/gcp/start_gcp_enclave.sh
  74. +27 −0 scripts/gcp/stop_gcp_enclave.sh
  75. +49 −0 scripts/get_operator_key.sh
  76. +26 −0 scripts/healthcheck.sh
  77. +21 −0 scripts/jq_helper.sh
  78. +112 −0 scripts/prepare_resources_for_e2e_docker_compose.sh
  79. +19 −0 scripts/save_enclave_id_to_admin.sh
  80. +72 −0 scripts/setup_bore.sh
  81. +219 −0 trivy-secret.yaml
9 changes: 9 additions & 0 deletions .github/workflows/build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Build and Test
on: [pull_request, push]

jobs:
build:
uses: IABTechLab/uid2-shared-actions/.github/workflows/shared-build-and-test.yaml@v3
secrets: inherit
with:
vulnerability_scan_only: true
78 changes: 47 additions & 31 deletions .github/workflows/shared-build-and-test.yaml
Original file line number Diff line number Diff line change
@@ -5,60 +5,76 @@ on:
java_version:
type: string
default: '11'
vulnerability_scan_only:
description: If true, only the vulnerability scanning step will run.
type: string
default: 'false'
publish_vulnerabilities:
type: string
default: 'true'
vulnerability_severity:
description: The severity to fail the workflow if such vulnerability is detected. DO NOT override it unless a Jira ticket is raised. Must be one of ['CRITICAL', 'CRITICAL,HIGH' or 'CRITICAL,HIGH,MEDIUM'] (without space in between).
type: string
default: 'CRITICAL,HIGH'
working_dir:
description: The path to the pom.xml file.
type: string
default: '.'
skip_tests:
description: If true, will skip tests when building and running unit tests. Defaults to false. Set to true for repos without tests.
type: string
default: 'false'

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Checkout uid2-shared-actions repo
uses: actions/checkout@v4
with:
ref: v3
repository: IABTechLab/uid2-shared-actions
path: ${{ inputs.working_dir }}/uid2-shared-actions

- name: Set up JDK
uses: actions/setup-java@v3
if: ${{ inputs.vulnerability_scan_only == 'false' }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ inputs.java_version }}

- name: Build and run unit tests
run: mvn -B clean compile test
if: ${{ inputs.vulnerability_scan_only == 'false' && inputs.skip_tests == 'false' }}
working-directory: ${{ inputs.working_dir }}
run: |
bash uid2-shared-actions/scripts/compile_java_test_and_verify.sh
- name: Build without unit tests
if: ${{ inputs.vulnerability_scan_only == 'false' && inputs.skip_tests == 'true' }}
working-directory: ${{ inputs.working_dir }}
run: |
mvn -B clean compile -DskipTests
- name: Generate code coverage
if: ${{ inputs.vulnerability_scan_only == 'false' }}
run: mvn jacoco:report
working-directory: ${{ inputs.working_dir }}

- name: Archive code coverage results
uses: actions/upload-artifact@v3
if: ${{ inputs.vulnerability_scan_only == 'false' }}
uses: actions/upload-artifact@v4
with:
name: code-coverage-report
path: target/site/jacoco/*

- name: Generate Trivy vulnerability scan report
uses: aquasecurity/trivy-action@0.12.0
if: inputs.publish_vulnerabilities == 'true'
with:
scan-type: 'fs'
format: 'sarif'
exit-code: '0'
ignore-unfixed: true
severity: 'CRITICAL,HIGH'
output: 'trivy-results.sarif'
hide-progress: true

- name: Upload Trivy scan report to GitHub Security tab
uses: github/codeql-action/upload-sarif@v2
if: inputs.publish_vulnerabilities == 'true'
with:
sarif_file: 'trivy-results.sarif'
path: ${{ inputs.working_dir }}/target/site/jacoco/*

- name: Test with Trivy vulnerability scanner
uses: aquasecurity/trivy-action@0.12.0
- name: Vulnerability Scan
uses: IABTechLab/uid2-shared-actions/actions/vulnerability_scan@v3
with:
scan-type: 'fs'
format: 'table'
exit-code: '1'
ignore-unfixed: true
severity: 'CRITICAL'
hide-progress: true
scan_severity: HIGH,CRITICAL
failure_severity: ${{ inputs.vulnerability_severity }}
publish_vulnerabilities: ${{ inputs.publish_vulnerabilities }}
scan_type: 'fs'
2 changes: 1 addition & 1 deletion .github/workflows/shared-check-stable-dependency.yaml
Original file line number Diff line number Diff line change
@@ -8,7 +8,7 @@ jobs:

steps:
- name: Checkout repo
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Resolve dependencies
run: mvn -B dependency:resolve
92 changes: 92 additions & 0 deletions .github/workflows/shared-increase-version-number.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
name: Shared Increase Version Number
on:
workflow_call:
inputs:
release_type:
description: The type of version number to return. Must be one of [Snapshot, Patch, Minor or Major]
required: true
type: string
version_number_input:
description: If set, the version number will not be incremented and the given number will be used.
default: ''
type: string
working_dir:
description: The path to the directory for which the version should be determined.
type: string
default: '.'
outputs:
new_version:
description: The new version number to publish for the docker repo
value: ${{ jobs.incrementVersionNumber.outputs.new_version }}
image_tag:
description: The image tag used to extract metadata for Docker
value: ${{ jobs.incrementVersionNumber.outputs.image_tag }}
git_tag_or_hash:
description: The git tag or hash (for snapshots) containing the updated version.
value: ${{ jobs.incrementVersionNumber.outputs.git_tag_or_hash }}

jobs:
incrementVersionNumber:
runs-on: ubuntu-latest
outputs:
new_version: ${{ steps.version.outputs.new_version }}
image_tag: ${{ steps.updatePackageJson.outputs.image_tag }}
git_tag_or_hash: ${{ steps.commit-and-tag.outcome == 'success' && steps.commit-and-tag.outputs.git_tag_or_hash || steps.commit-without-tag.outputs.git_tag_or_hash }}
steps:
- name: Setup
id: setup
uses: IABTechLab/uid2-shared-actions/actions/shared_publish_setup@v2
with:
release_type: ${{ inputs.release_type }}

- uses: actions/setup-node@v4
with:
node-version: 20

- name: Set version number
id: version
uses: IABTechLab/uid2-shared-actions/actions/version_number@v2
with:
type: ${{ inputs.release_type }}
version_number: ${{ inputs.version_number_input }}
branch_name: ${{ github.ref }}
working_dir: ${{ inputs.working_dir }}

- name: Update ${{ inputs.working_dir }}/package.json
id: updatePackageJson
run: |
current_version=$(jq -r '.version')
new_version=${{ steps.version.outputs.new_version }}
jq --arg v "$new_version" ".version = \$v" "${{ inputs.working_dir }}/package.json" > tmp.json && mv tmp.json "${{ inputs.working_dir }}/package.json"
echo "Version number updated from $current_version to $new_version"
echo "image_tag=${{ steps.version.outputs.new_version }}" >> $GITHUB_OUTPUT
- name: Update ${{ inputs.working_dir }}/package-lock.json
id: updatePackageLockJson
run: |
npm install --package-lock-only
- name: Commit ${{ inputs.working_dir }}/package.json, ${{ inputs.working_dir }}/package-lock.json and ${{ inputs.working_dir }}/version.json
if: ${{ inputs.version_number_input == '' && steps.setup.outputs.IS_RELEASE != 'true' }}
id: commit-without-tag
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@main
with:
add: '${{ inputs.working_dir }}/package.json ${{ inputs.working_dir }}/package-lock.json ${{ inputs.working_dir }}/version.json'
message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}'

- name: Commit ${{ inputs.working_dir }}/package.json, ${{ inputs.working_dir }}/package-lock.json, ${{ inputs.working_dir }}/version.json and set tag
if: ${{ inputs.version_number_input == '' && steps.setup.outputs.IS_RELEASE == 'true' }}
id: commit-and-tag
uses: IABTechLab/uid2-shared-actions/actions/commit_pr_and_merge@main
with:
add: '${{ inputs.working_dir }}/package.json ${{ inputs.working_dir }}/package-lock.json ${{ inputs.working_dir }}/version.json'
message: 'Released ${{ inputs.release_type }} version: ${{ steps.version.outputs.new_version }}'
tag: v${{ steps.version.outputs.new_version }}

- name: Print outputs
uses: actions/github-script@v7
with:
script: |
console.log('Result', '${{ steps.commit-and-tag.outcome }}');
console.log('Commit and tag', '${{ steps.commit-and-tag.outputs.git_tag_or_hash }}');
console.log('No tag', '${{ steps.commit-without-tag.outputs.git_tag_or_hash }}');
133 changes: 0 additions & 133 deletions .github/workflows/shared-java-publish-versioned-package.yaml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/shared-promote-auto-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Create Deployment Pull Request
on:
workflow_call:
jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Create Pull Request
run: |
echo "branch ${{ github.ref }} was pushed to"
if [ ${{ github.ref }} == "refs/heads/main" ]; then
base="test"
elif [ ${{ github.ref }} == "refs/heads/test" ]; then
base="integ"
elif [ ${{ github.ref }} == "refs/heads/integ" ]; then
base="prod"
else
exit 0
fi
echo "promotion is to ${base}"
# Check if a PR already exists
existing_pr=$(gh pr list --base ${base} --head main --state open --json number --jq '.[0].number')
if [ -z "$existing_pr" ]; then
echo "No existing PR found. Creating a new PR."
gh pr create --base ${base} --head main --title "PR from main to ${base}" --body "Automated PR from main to ${base} branch"
else
echo "PR already exists: #$existing_pr"
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Loading