From 3650bbdd3aa5e3de97ee411ee9325582faedce97 Mon Sep 17 00:00:00 2001 From: Kristen Wilkinson Date: Mon, 28 Aug 2023 12:11:02 +0100 Subject: [PATCH 1/6] Start work for issue #159 From 680b67c48ea74b977ccb2a756735ef9fd13d354b Mon Sep 17 00:00:00 2001 From: Kristen Wilkinson Date: Mon, 28 Aug 2023 12:12:05 +0100 Subject: [PATCH 2/6] ci: update workflow trigger --- .github/workflows/add-new-issue-to-project.yml | 2 +- .github/workflows/build-status-check.yml | 2 +- .github/workflows/sync-issue-to-pr.yml | 2 +- .github/workflows/sync-status-check.yml | 2 +- .github/workflows/unit-test-status-check.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/add-new-issue-to-project.yml b/.github/workflows/add-new-issue-to-project.yml index aef1116..a72b5c5 100644 --- a/.github/workflows/add-new-issue-to-project.yml +++ b/.github/workflows/add-new-issue-to-project.yml @@ -4,7 +4,7 @@ name: 🤖Add New Issue To Project on: issues: types: opened - pull_request: + pull_request_target: types: opened branches: [main, preview] diff --git a/.github/workflows/build-status-check.yml b/.github/workflows/build-status-check.yml index 4038ab6..cb95d65 100644 --- a/.github/workflows/build-status-check.yml +++ b/.github/workflows/build-status-check.yml @@ -3,7 +3,7 @@ run-name: ✅Build Status Check (${{ github.base_ref }} branch) on: - pull_request: + pull_request_target: branches: [main, preview] diff --git a/.github/workflows/sync-issue-to-pr.yml b/.github/workflows/sync-issue-to-pr.yml index dc2ace5..c153e97 100644 --- a/.github/workflows/sync-issue-to-pr.yml +++ b/.github/workflows/sync-issue-to-pr.yml @@ -7,7 +7,7 @@ defaults: on: - pull_request: + pull_request_target: types: opened issue_comment: # This event is triggered when creating issue and pr comments types: created diff --git a/.github/workflows/sync-status-check.yml b/.github/workflows/sync-status-check.yml index e1e85c7..3798693 100644 --- a/.github/workflows/sync-status-check.yml +++ b/.github/workflows/sync-status-check.yml @@ -7,7 +7,7 @@ defaults: on: - pull_request: + pull_request_target: branches: [main, preview] diff --git a/.github/workflows/unit-test-status-check.yml b/.github/workflows/unit-test-status-check.yml index c271341..fdbcdef 100644 --- a/.github/workflows/unit-test-status-check.yml +++ b/.github/workflows/unit-test-status-check.yml @@ -3,7 +3,7 @@ run-name: ✅Unit Testing Status Check (${{ github.base_ref }} branch) on: - pull_request: + pull_request_target: branches: [main, preview] From 2164b78f0da7478ab66e348480f5b488cda96432 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Thu, 31 Aug 2023 19:14:42 +0100 Subject: [PATCH 3/6] ci: rename workflow --- .github/workflows/{sync-issue-to-pr.yml => sync-pr-to-issue.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{sync-issue-to-pr.yml => sync-pr-to-issue.yml} (100%) diff --git a/.github/workflows/sync-issue-to-pr.yml b/.github/workflows/sync-pr-to-issue.yml similarity index 100% rename from .github/workflows/sync-issue-to-pr.yml rename to .github/workflows/sync-pr-to-issue.yml From f4dadae99c0eefb9b638d3b39627326c7ba4a452 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Thu, 31 Aug 2023 19:15:05 +0100 Subject: [PATCH 4/6] ci: refactor workflow to use reusable workflow --- .github/workflows/sync-pr-to-issue.yml | 64 ++++++++++---------------- 1 file changed, 24 insertions(+), 40 deletions(-) diff --git a/.github/workflows/sync-pr-to-issue.yml b/.github/workflows/sync-pr-to-issue.yml index c153e97..636015f 100644 --- a/.github/workflows/sync-pr-to-issue.yml +++ b/.github/workflows/sync-pr-to-issue.yml @@ -1,4 +1,4 @@ -name: 🔄️Sync Issue To PR +name: 🔄️Sync PR To Issue defaults: @@ -14,42 +14,26 @@ on: jobs: - sync_issue_to_pr: - name: Start Sync Process - if: | - (github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run-sync]')) || - github.event_name == 'pull_request' && startsWith(github.head_ref, 'feature/') - runs-on: ubuntu-latest - steps: - - name: Set Up Deno - uses: denoland/setup-deno@v1 - with: - deno-version: v1.x - - - name: Sync - run: | - $eventName = "${{ github.event_name }}"; - $scriptUrl = "${{ vars.SCRIPT_BASE_URL }}/${{ vars.CICD_SCRIPTS_VERSION }}/${{ vars.SCRIPT_RELATIVE_DIR_PATH }}/sync-issue-to-pr.ts"; - $issueOrPrNumber = $eventName -eq "pull_request" ? "${{ github.event.number }}" : "${{ github.event.issue.number }}"; - - Write-Host "::notice::Event Type: $eventName"; - Write-Host "::notice::Organization Name: ${{ vars.ORGANIZATION_NAME }}"; - Write-Host "::notice::Project Name: ${{ vars.PROJECT_NAME }}"; - Write-Host "::notice::Requested By: ${{ github.event.sender.login }}"; - Write-Host "::notice::PR Number: $issueOrPrNumber"; - - <# Deno Args: - 1. Organization name - 2. Project name - 3. Triggered by user - 4. Issue or pull request number - 5. PAT - #> - deno run ` - --allow-net ` - "$scriptUrl" ` - "${{ vars.ORGANIZATION_NAME }}" ` - "${{ vars.PROJECT_NAME }}" ` - "${{ github.event.sender.login }}" ` - "$issueOrPrNumber" ` - "${{ secrets.CICD_TOKEN }}"; + initial_sync: + name: Start Initial Sync + if: ${{ github.event_name == 'pull_request_target' }} + uses: KinsonDigital/Infrastructure/.github/workflows/initial-manual-sync.yml@v13.0.0 + with: + issue-or-pr-number: ${{ github.event.pull_request.number }} + sync-type: initial + requested-by: ${{ github.event.sender.login }} + branch: ${{ github.event.pull_request.head.ref }} # Input not required for initial sync + secrets: + cicd-pat: ${{ secrets.CICD_TOKEN }} + + + manual_sync: + name: Start Manual Sync + if: ${{ github.event_name == 'issue_comment' && contains(github.event.comment.body, '[run-sync]') }} + uses: KinsonDigital/Infrastructure/.github/workflows/initial-manual-sync.yml@v13.0.0 + with: + issue-or-pr-number: ${{ github.event.issue.number }} + sync-type: manual + requested-by: "validate:${{ github.event.sender.login }}" + secrets: + cicd-pat: ${{ secrets.CICD_TOKEN }} From ea447430e099e601d774f739c5b6bfe9ef8b7c93 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Thu, 31 Aug 2023 19:17:20 +0100 Subject: [PATCH 5/6] ci: replace deno version literal with repo var expression --- .github/workflows/sync-bot.yml | 2 +- .github/workflows/sync-status-check.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/sync-bot.yml b/.github/workflows/sync-bot.yml index 91f2d04..b4aa2a5 100644 --- a/.github/workflows/sync-bot.yml +++ b/.github/workflows/sync-bot.yml @@ -20,7 +20,7 @@ jobs: - name: Set Up Deno uses: denoland/setup-deno@v1 with: - deno-version: v1.x + deno-version: ${{ vars.DENO_VERSION }} - name: Run Sync Bot (Issue Change) run: | diff --git a/.github/workflows/sync-status-check.yml b/.github/workflows/sync-status-check.yml index 3798693..2e7bad5 100644 --- a/.github/workflows/sync-status-check.yml +++ b/.github/workflows/sync-status-check.yml @@ -20,7 +20,7 @@ jobs: - name: Set Up Deno uses: denoland/setup-deno@v1 with: - deno-version: v1.x + deno-version: ${{ vars.DENO_VERSION }} - name: Run Sync Status Check run: | From 4b10710c6975529b5ba9a69dbc1ded133efc9314 Mon Sep 17 00:00:00 2001 From: Calvin Wilkinson Date: Thu, 31 Aug 2023 19:17:37 +0100 Subject: [PATCH 6/6] ci: update reusable workflow versions --- .github/workflows/add-new-issue-to-project.yml | 2 +- .github/workflows/build-status-check.yml | 2 +- .github/workflows/prepare-release.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/unit-test-status-check.yml | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/add-new-issue-to-project.yml b/.github/workflows/add-new-issue-to-project.yml index a72b5c5..a13646c 100644 --- a/.github/workflows/add-new-issue-to-project.yml +++ b/.github/workflows/add-new-issue-to-project.yml @@ -12,7 +12,7 @@ on: jobs: add_new_issue_to_project: name: Add New Issue - uses: KinsonDigital/Infrastructure/.github/workflows/add-issue-to-project.yml@v11.0.0 + uses: KinsonDigital/Infrastructure/.github/workflows/add-issue-to-project.yml@v13.0.0 with: org-name: "${{ vars.ORGANIZATION_NAME }}" org-project-name: "${{ vars.ORG_PROJECT_NAME }}" diff --git a/.github/workflows/build-status-check.yml b/.github/workflows/build-status-check.yml index cb95d65..face44b 100644 --- a/.github/workflows/build-status-check.yml +++ b/.github/workflows/build-status-check.yml @@ -10,7 +10,7 @@ on: jobs: build_project: name: ${{ vars.PROJECT_NAME }} Build Status Check - uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v11.0.0 + uses: KinsonDigital/Infrastructure/.github/workflows/build-csharp-project.yml@v13.0.0 with: project-name: ${{ vars.PROJECT_NAME }} build-config: Debug diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml index 47dc6ae..632b879 100644 --- a/.github/workflows/prepare-release.yml +++ b/.github/workflows/prepare-release.yml @@ -73,7 +73,7 @@ jobs: prepare_release: name: Prepare ${{ inputs.release-type }} Release Of ${{ vars.PROJECT_NAME }} needs: print_validate_workflow - uses: KinsonDigital/Infrastructure/.github/workflows/prepare-release.yml@v11.0.0 + uses: KinsonDigital/Infrastructure/.github/workflows/prepare-release.yml@v13.0.0 with: project-name: ${{ vars.PROJECT_NAME }} release-type: ${{ inputs.release-type }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 3f20f38..d0515a7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,7 @@ jobs: perform_release: name: Performing ${{ inputs.release-type }} Release of ${{ vars.PROJECT_NAME }} (${{ inputs.release-type == 'Production' && 'Release' || 'Debug' }}) needs: determine_release_notes_path - uses: KinsonDigital/Infrastructure/.github/workflows/dotnet-action-release.yml@v11.0.0 + uses: KinsonDigital/Infrastructure/.github/workflows/dotnet-action-release.yml@v13.0.0 with: project-name: "${{ vars.PROJECT_NAME }}" release-type: "${{ inputs.release-type }}" diff --git a/.github/workflows/unit-test-status-check.yml b/.github/workflows/unit-test-status-check.yml index fdbcdef..41bc57b 100644 --- a/.github/workflows/unit-test-status-check.yml +++ b/.github/workflows/unit-test-status-check.yml @@ -10,7 +10,7 @@ on: jobs: run_tests: name: ${{ vars.PROJECT_NAME }} Test Status Check - uses: KinsonDigital/Infrastructure/.github/workflows/run-csharp-tests.yml@v11.0.0 + uses: KinsonDigital/Infrastructure/.github/workflows/run-csharp-tests.yml@v13.0.0 with: project-name: ${{ vars.PROJECT_NAME }}Tests build-config: Debug