From 08dc5dfffe7a432a78346f5ac491e8a1fc5b1ef5 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 29 Dec 2021 14:33:59 -0600 Subject: [PATCH 01/78] add skeletons for bootstrap workflows --- .github/workflows/add_pack_maintainers.yaml | 43 +++++++++ .github/workflows/bootstrap_pack_from_pr.yaml | 87 +++++++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 .github/workflows/add_pack_maintainers.yaml create mode 100644 .github/workflows/bootstrap_pack_from_pr.yaml diff --git a/.github/workflows/add_pack_maintainers.yaml b/.github/workflows/add_pack_maintainers.yaml new file mode 100644 index 00000000..26cc4002 --- /dev/null +++ b/.github/workflows/add_pack_maintainers.yaml @@ -0,0 +1,43 @@ +name: Add Pack Maintainers + +on: + issue_comment: + types: created + +jobs: + tsc_membership_check: + # "!add pack maintainers ..." comment on pull requests + if: startsWith(github.event.comment.body, '!add pack maintainers') && github.event.issue.pull_request + + runs-on: ubuntu-latest + steps: + - name: Validate commentor permissions + # must be a TSC member + + repo_is_ready_check: + needs: [tsc_membership_check] + runs-on: ubuntu-latest + steps: + - name: Make sure incubator PR is approved + - name: Make sure pack repo is bootstrapped + + - name: Publish status in incubator PR comment # and/or label + + bootstrap_pack_repo: + needs: [tsc_membership_check, repo_is_ready_check] + runs-on: ubuntu-latest + steps: + - name: Parse comment to get maintainer details + # output needs-team + + - name: Add team + if: needs-team + - name: Add maintainers to team + if: needs-team + - name: Add team to repo + if: needs-team + + - name: Add maintainers to repo + if: ! needs-team + + - name: Publish status in incubator PR comment # and/or label diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml new file mode 100644 index 00000000..0a95edc4 --- /dev/null +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -0,0 +1,87 @@ +name: Bootstrack Pack from PR + +on: +# pull_request_target: +# types: [labeled] +# pull_request_review: +# types: [submitted] + issue_comment: + types: created + +jobs: + tsc_membership_check: + # "!bootstrap pack" comment on pull requests + if: github.event.comment.body == '!bootstrap pack' && github.event.issue.pull_request + + runs-on: ubuntu-latest + steps: + - name: Validate commentor permissions + # must be a TSC member + + ready_to_merge_check: + needs: [tsc_membership_check] + runs-on: ubuntu-latest + steps: + - name: Make sure incubator PR is approved + - name: Make sure CI workflow is passing for PR + + - name: Publish status in incubator PR comment # and/or label + + bootstrap_pack_repo: + needs: [tsc_membership_check, ready_to_merge_check] + runs-on: ubuntu-latest + steps: + - name: Checkout Incubator PR + - name: Extract Pack Details + - name: Check PR type (subdirectory or submodule) + # output for use in subsequent job(s) + + - name: Check if pack repo exists + - name: Create pack repo alias on Github + # include pack description and exchange url + - name: Give TSC permissions on repo + - name: Rename pack repo on Github + # {pack_name} -> stackstorm-{pack_name} + + - name: Create empty pack repo directory + - name: Bootstrap pack CI files + # minimal set of required files + - name: Commit and Push initial commit + + - name: Configure Github to send webhook notifications to Slack + + - name: Publish status in incubator PR comment # and/or label + + create_pack_pr_from_subdirectory: + needs: [tsc_membership_check, ready_to_merge_check, bootstrap_pack] + if: jobs.bootstrap_pack_repo.? == 'subdirectory' + runs-on: ubuntu-latest + steps: + - name: Checkout pack repo + + - name: Add incubator as git remote + - name: Checkout Incubator PR + + - name: Create branch for initial pack content + - name: Copy Incubator PR contents + - name: Commit and Push + + - name: Create initial content PR on pack repo (subdirectory) + + - name: Publish status in incubator PR comment # and/or label + + create_pack_pr_from_subdirectory: + needs: [tsc_membership_check, ready_to_merge_check, bootstrap_pack] + if: jobs.bootstrap_pack_repo.? == 'submodule' + runs-on: ubuntu-latest + steps: + - name: Checkout pack repo + - name: Add git remote for source repo in incubator submodule + - name: Pull source history into pack repo + # --allow-unrelated-histories + # fix merge conflicts by preferring exchange-provided files + # (which should be a minimal required set of files) + + - name: Create initial content PR on pack repo + + - name: Publish status in incubator PR comment # and/or label From 28fc801617ee51004ece01e43d48873504cd75f3 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 31 Dec 2021 11:07:18 -0600 Subject: [PATCH 02/78] gha: use gh to create repo --- .github/workflows/bootstrap_pack_from_pr.yaml | 26 ++++++++++++++----- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 0a95edc4..2757978e 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -38,17 +38,29 @@ jobs: - name: Check if pack repo exists - name: Create pack repo alias on Github - # include pack description and exchange url - - name: Give TSC permissions on repo + # Alias means repo without stackstorm- prefix + working-directory: pack + shell: bash + run: > + gh repo create StackStorm-Exchange/${{ env.PACK_NAME }} + --public + --homepage ${{ env.PACK_HOMEPAGE }} + --description ${{ env.PACK_DESCRIPTION }} + --template StackStorm-Exchange/exchange-template + --team TSC + --clone + #TODO: e Make sure TSC has maintainer permissions on repo - name: Rename pack repo on Github # {pack_name} -> stackstorm-{pack_name} - - - name: Create empty pack repo directory - - name: Bootstrap pack CI files - # minimal set of required files - - name: Commit and Push initial commit + working-directory: pack + shell: bash + run: | + gh repo rename ${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} - name: Configure Github to send webhook notifications to Slack + working-directory: pack + shell: bash + run: | - name: Publish status in incubator PR comment # and/or label From fb04af1f1a1e8cbb67fb05a9a499eaea58bea466 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Fri, 31 Dec 2021 15:27:29 -0600 Subject: [PATCH 03/78] gha: expand pack repo creation workflow --- .github/workflows/bootstrap_pack_from_pr.yaml | 118 ++++++++++++++++-- 1 file changed, 105 insertions(+), 13 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 2757978e..5b918382 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -8,6 +8,16 @@ on: issue_comment: types: created +# need vars: +# env.PACK_ORG: StackStorm-Exchange +# env.PACK_REPO_PREFIX: stackstorm +# env.PACK_REPO_TEMPLATE: StackStorm-Exchange/exchange-template +# env.TSC_TEAM: TSC +# +# need secrets: +# env.GH_TOKEN: admin bot PAT w/ scopes public_repo, workflow, write:org +# env.SLACK_WEBHOOK_URL + jobs: tsc_membership_check: # "!bootstrap pack" comment on pull requests @@ -32,35 +42,106 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout Incubator PR + - name: Extract Pack Details + # PACK_NAME + # PACK_HOMEPAGE + # PACK_DESCRIPTION + - name: Check PR type (subdirectory or submodule) # output for use in subsequent job(s) - - name: Check if pack repo exists - - name: Create pack repo alias on Github - # Alias means repo without stackstorm- prefix - working-directory: pack + - name: Check if pack repo needs to be created + id: do-create-repo + continue-on-error: true + shell: bash + # we negate the rc so 1 means repo already exists, 0 means does not exist + run: > + ! gh repo view + ${{ env.PACK_ORG }}/${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} + --json nameWithOwner -q .nameWithOwner + + - name: Check if pack repo was partially created + if: steps.do-create-repo.outcome == 'success' + id: do-rename-repo + continue-on-error: true shell: bash run: > - gh repo create StackStorm-Exchange/${{ env.PACK_NAME }} + gh repo view + ${{ env.PACK_ORG }}/${{ env.PACK_NAME }} + --json nameWithOwner -q .nameWithOwner + + - name: Create pack repo on Github + id: created-repo + if: > + steps.do-create-repo.outcome == 'success' + && steps.do-rename-repo.outcome == 'failure' + shell: bash + # First create repo w/o stackstorm- prefix + # Then rename it to add the prefix. + # This creates a redirect/alias on github w/o the prefix. + run: > + gh repo create ${{ env.PACK_ORG }}/${{ env.PACK_NAME }} --public --homepage ${{ env.PACK_HOMEPAGE }} --description ${{ env.PACK_DESCRIPTION }} - --template StackStorm-Exchange/exchange-template - --team TSC - --clone - #TODO: e Make sure TSC has maintainer permissions on repo + --template ${{ env.PACK_REPO_TEMPLATE }} + - name: Rename pack repo on Github - # {pack_name} -> stackstorm-{pack_name} + if: > + steps.do-rename-repo.outcome == 'success' + || steps.created-repo.outcome == 'success' + shell: bash + run: > + gh repo rename + '${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }}' + -R '${{ env.PACK_ORG }}/${{ env.PACK_NAME }}' + --confirm + + - name: Checkout pack repo + uses: actions/checkout@v2 + with: + repository: ${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} + path: pack + fetch-depth: 0 + + - name: Update pack repo metadata on Github + if: steps.do-create-repo.outcome == 'failure' working-directory: pack shell: bash - run: | - gh repo rename ${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} + run: > + gh api -X PATCH 'repos/{owner}/{repo}' + -f "description=${PACK_DESCRIPTION}" + -f "homepage=${PACK_HOMEPAGE}" + + # Using `gh repo create ... --team=TSC` only gives read permission, not maintain. + - name: Make sure TSC team has maintainer permissions on pack repo + working-directory: pack + shell: bash + run: > + gh api -X PUT /orgs/{owner}/teams/${{ env.TSC_TEAM }}/repos/{owner}/{repo} + -f permission=maintain - name: Configure Github to send webhook notifications to Slack working-directory: pack shell: bash run: | + jq -n '{ + "name": "web", + "active": true, + "config": { + "url": "'"${SLACK_WEBHOOK_URL}"'", + "content_type": "application/json" + }, + "events": [ + "commit_comment", + "issue_comment", + "issues", + "pull_request", + "pull_request_review", + "pull_request_review_comment" + ] + }' | gh api repos/{owner}/{repo}/hooks --input - - name: Publish status in incubator PR comment # and/or label @@ -70,6 +151,11 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout pack repo + uses: actions/checkout@v2 + with: + repository: ${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} + path: pack + fetch-depth: 0 - name: Add incubator as git remote - name: Checkout Incubator PR @@ -82,12 +168,18 @@ jobs: - name: Publish status in incubator PR comment # and/or label - create_pack_pr_from_subdirectory: + create_pack_pr_from_submodule: needs: [tsc_membership_check, ready_to_merge_check, bootstrap_pack] if: jobs.bootstrap_pack_repo.? == 'submodule' runs-on: ubuntu-latest steps: - name: Checkout pack repo + uses: actions/checkout@v2 + with: + repository: ${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} + path: pack + fetch-depth: 0 + - name: Add git remote for source repo in incubator submodule - name: Pull source history into pack repo # --allow-unrelated-histories From a4101b7397abece1e92286b8cbde2fe67c792fff Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sat, 1 Jan 2022 14:26:57 -0600 Subject: [PATCH 04/78] gha: use reusable workflow + action from ci repo --- .github/workflows/bootstrap_pack_from_pr.yaml | 132 ++++-------------- 1 file changed, 26 insertions(+), 106 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 5b918382..88e01dfe 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -37,117 +37,37 @@ jobs: - name: Publish status in incubator PR comment # and/or label - bootstrap_pack_repo: + extract_pack_details: needs: [tsc_membership_check, ready_to_merge_check] runs-on: ubuntu-latest steps: - - name: Checkout Incubator PR - - name: Extract Pack Details - # PACK_NAME - # PACK_HOMEPAGE - # PACK_DESCRIPTION - - - name: Check PR type (subdirectory or submodule) - # output for use in subsequent job(s) - - - name: Check if pack repo needs to be created - id: do-create-repo - continue-on-error: true - shell: bash - # we negate the rc so 1 means repo already exists, 0 means does not exist - run: > - ! gh repo view - ${{ env.PACK_ORG }}/${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} - --json nameWithOwner -q .nameWithOwner - - - name: Check if pack repo was partially created - if: steps.do-create-repo.outcome == 'success' - id: do-rename-repo - continue-on-error: true - shell: bash - run: > - gh repo view - ${{ env.PACK_ORG }}/${{ env.PACK_NAME }} - --json nameWithOwner -q .nameWithOwner - - - name: Create pack repo on Github - id: created-repo - if: > - steps.do-create-repo.outcome == 'success' - && steps.do-rename-repo.outcome == 'failure' - shell: bash - # First create repo w/o stackstorm- prefix - # Then rename it to add the prefix. - # This creates a redirect/alias on github w/o the prefix. - run: > - gh repo create ${{ env.PACK_ORG }}/${{ env.PACK_NAME }} - --public - --homepage ${{ env.PACK_HOMEPAGE }} - --description ${{ env.PACK_DESCRIPTION }} - --template ${{ env.PACK_REPO_TEMPLATE }} - - - name: Rename pack repo on Github - if: > - steps.do-rename-repo.outcome == 'success' - || steps.created-repo.outcome == 'success' - shell: bash - run: > - gh repo rename - '${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }}' - -R '${{ env.PACK_ORG }}/${{ env.PACK_NAME }}' - --confirm + id: pack-details + # TODO: switch from @gha to @master + uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta.yaml@gha + outputs: + pack_name: ${{ steps.pack-details.outputs.pack_name }} + pack_ref: ${{ steps.pack-details.outputs.pack_ref }} + pack_description: ${{ steps.pack-details.outputs.pack_description }} + in_submodule: ${{ steps.pack-details.outputs.in_submodule }} + in_subdir: ${{ steps.pack-details.outputs.in_subdir }} - - name: Checkout pack repo - uses: actions/checkout@v2 - with: - repository: ${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} - path: pack - fetch-depth: 0 - - - name: Update pack repo metadata on Github - if: steps.do-create-repo.outcome == 'failure' - working-directory: pack - shell: bash - run: > - gh api -X PATCH 'repos/{owner}/{repo}' - -f "description=${PACK_DESCRIPTION}" - -f "homepage=${PACK_HOMEPAGE}" - - # Using `gh repo create ... --team=TSC` only gives read permission, not maintain. - - name: Make sure TSC team has maintainer permissions on pack repo - working-directory: pack - shell: bash - run: > - gh api -X PUT /orgs/{owner}/teams/${{ env.TSC_TEAM }}/repos/{owner}/{repo} - -f permission=maintain - - - name: Configure Github to send webhook notifications to Slack - working-directory: pack - shell: bash - run: | - jq -n '{ - "name": "web", - "active": true, - "config": { - "url": "'"${SLACK_WEBHOOK_URL}"'", - "content_type": "application/json" - }, - "events": [ - "commit_comment", - "issue_comment", - "issues", - "pull_request", - "pull_request_review", - "pull_request_review_comment" - ] - }' | gh api repos/{owner}/{repo}/hooks --input - - - - name: Publish status in incubator PR comment # and/or label + bootstrap_pack_repo: + needs: [extract_pack_details] + name: New Pack # / Bootstrap Repo + # TODO: switch from @gha to @master + uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha + with: + # secrets + admin_token: "" # TODO: admin PAT with scopes: public_repo, workflows, org:write + slack_webhook_url: "" # TODO + # or should this use pack_ref ? + pack_name: ${{ jobs.extract_pack_details.outputs.pack_name }} + pack_description: ${{ jobs.extract_pack_details.outputs.pack_description }} create_pack_pr_from_subdirectory: - needs: [tsc_membership_check, ready_to_merge_check, bootstrap_pack] - if: jobs.bootstrap_pack_repo.? == 'subdirectory' + needs: [extract_pack_details, bootstrap_pack] + if: jobs.extract_pack_details.outputs.in_submodule == 'false' runs-on: ubuntu-latest steps: - name: Checkout pack repo @@ -169,8 +89,8 @@ jobs: - name: Publish status in incubator PR comment # and/or label create_pack_pr_from_submodule: - needs: [tsc_membership_check, ready_to_merge_check, bootstrap_pack] - if: jobs.bootstrap_pack_repo.? == 'submodule' + needs: [extract_pack_details, bootstrap_pack] + if: jobs.extract_pack_details.outputs.in_submodule == 'true' runs-on: ubuntu-latest steps: - name: Checkout pack repo From 75e2c4a27cb58a79f5f62d06e79581c6bd60e033 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sat, 1 Jan 2022 14:39:48 -0600 Subject: [PATCH 05/78] gha: use pack_repo output var --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 88e01dfe..ef1a4d8f 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -73,7 +73,7 @@ jobs: - name: Checkout pack repo uses: actions/checkout@v2 with: - repository: ${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} + repository: ${{ jobs.bootstrap_pack_repo.outputs.pack_repo }} path: pack fetch-depth: 0 @@ -96,7 +96,7 @@ jobs: - name: Checkout pack repo uses: actions/checkout@v2 with: - repository: ${{ env.PACK_REPO_PREFIX }}-${{ env.PACK_NAME }} + repository: ${{ jobs.bootstrap_pack_repo.outputs.pack_repo }} path: pack fetch-depth: 0 From 7e14d242b611efd37ebe9552d6ed6a8a5992e16b Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sat, 1 Jan 2022 14:44:37 -0600 Subject: [PATCH 06/78] prefer pack ref for repo name --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index ef1a4d8f..070beaa9 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -61,8 +61,8 @@ jobs: # secrets admin_token: "" # TODO: admin PAT with scopes: public_repo, workflows, org:write slack_webhook_url: "" # TODO - # or should this use pack_ref ? - pack_name: ${{ jobs.extract_pack_details.outputs.pack_name }} + # TODO: validate that this || works as expected + pack_name: ${{ jobs.extract_pack_details.outputs.pack_ref || jobs.extract_pack_details.outputs.pack_name }} pack_description: ${{ jobs.extract_pack_details.outputs.pack_description }} create_pack_pr_from_subdirectory: From 0ffab7c8b778d64fb91ee592e4d097e51758baaf Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sat, 1 Jan 2022 14:50:45 -0600 Subject: [PATCH 07/78] gha: add links to process def comments --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 070beaa9..8dc7b1df 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -65,6 +65,7 @@ jobs: pack_name: ${{ jobs.extract_pack_details.outputs.pack_ref || jobs.extract_pack_details.outputs.pack_name }} pack_description: ${{ jobs.extract_pack_details.outputs.pack_description }} + # based on https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-923614663 create_pack_pr_from_subdirectory: needs: [extract_pack_details, bootstrap_pack] if: jobs.extract_pack_details.outputs.in_submodule == 'false' @@ -88,6 +89,7 @@ jobs: - name: Publish status in incubator PR comment # and/or label + # based on https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-281247786 create_pack_pr_from_submodule: needs: [extract_pack_details, bootstrap_pack] if: jobs.extract_pack_details.outputs.in_submodule == 'true' From 5d98acb27588ae0509d95e309edb613f864f9155 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sat, 1 Jan 2022 19:54:02 -0600 Subject: [PATCH 08/78] gha: checkout various repos during bootstrap --- .github/workflows/bootstrap_pack_from_pr.yaml | 46 ++++++++++++++++++- 1 file changed, 45 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 8dc7b1df..dd22f015 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -45,10 +45,17 @@ jobs: id: pack-details # TODO: switch from @gha to @master uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta.yaml@gha + with: + pack-directory: incubator + repository: ${{ github.repository }} + # expects an issue_comment event + ref: pull/${{ github.event.issue.number }}/head + fetch-depth: 0 outputs: pack_name: ${{ steps.pack-details.outputs.pack_name }} pack_ref: ${{ steps.pack-details.outputs.pack_ref }} pack_description: ${{ steps.pack-details.outputs.pack_description }} + pack_path: ${{ steps.pack-details.outputs.pack_path }} in_submodule: ${{ steps.pack-details.outputs.in_submodule }} in_subdir: ${{ steps.pack-details.outputs.in_subdir }} @@ -78,8 +85,25 @@ jobs: path: pack fetch-depth: 0 - - name: Add incubator as git remote + - name: Checkout incubator + uses: actions/checkout@v2 + with: + path: incubator + fetch-depth: 0 + - name: Checkout Incubator PR + working-directory: incubator + shell: bash + run: | + git fetch origin pull/${{ github.event.issue.number }}/head:pr + git checkout pr + + - name: Add incubator as git remote + working-directory: pack + shell: bash + run: | + git remote add source ../incubator + git fetch source - name: Create branch for initial pack content - name: Copy Incubator PR contents @@ -102,7 +126,27 @@ jobs: path: pack fetch-depth: 0 + - name: Checkout incubator + uses: actions/checkout@v2 + with: + path: incubator + fetch-depth: 0 + + - name: Checkout Incubator PR and Submodules + shell: bash + run: | + git fetch origin pull/${{ github.event.issue.number }}/head:pr + git checkout pr + git submodule init + git submodule update --remote + - name: Add git remote for source repo in incubator submodule + working-directory: pack + shell: bash + run: | + git remote add source ${{ jobs.extract_pack_details.outputs.pack_path }} + git fetch source + - name: Pull source history into pack repo # --allow-unrelated-histories # fix merge conflicts by preferring exchange-provided files From a8033b1277a0372496e0286408a578055335dde4 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sat, 1 Jan 2022 20:02:37 -0600 Subject: [PATCH 09/78] gha: bootstrap creates a transfer branch --- .github/workflows/bootstrap_pack_from_pr.yaml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index dd22f015..10341dd4 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -106,6 +106,11 @@ jobs: git fetch source - name: Create branch for initial pack content + working-directory: pack + shell: bash + run: | + git checkout -b transfer + - name: Copy Incubator PR contents - name: Commit and Push @@ -147,10 +152,21 @@ jobs: git remote add source ${{ jobs.extract_pack_details.outputs.pack_path }} git fetch source + - name: Create branch for initial pack content + working-directory: pack + shell: bash + run: | + git checkout -b transfer + - name: Pull source history into pack repo # --allow-unrelated-histories # fix merge conflicts by preferring exchange-provided files # (which should be a minimal required set of files) + working-directory: pack + shell: bash + run: | + # TODO: specify pull/merge strategy + git pull source HEAD --allow-unrelated-histories - name: Create initial content PR on pack repo From 61e227ba743104fdd8be0e4cfbe10cc9589ca102 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sat, 1 Jan 2022 21:01:22 -0600 Subject: [PATCH 10/78] gha: specify merge strategy --- .github/workflows/bootstrap_pack_from_pr.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 10341dd4..a448e320 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -159,14 +159,14 @@ jobs: git checkout -b transfer - name: Pull source history into pack repo - # --allow-unrelated-histories - # fix merge conflicts by preferring exchange-provided files - # (which should be a minimal required set of files) working-directory: pack shell: bash + # ort strategy replaces recursive strategy on git 2.33+ + # ours => Fix merge conflicts by preferring exchange-provided files + # (which should be a minimal required set of files). + # Update the PR before merging if needed. run: | - # TODO: specify pull/merge strategy - git pull source HEAD --allow-unrelated-histories + git pull source HEAD --allow-unrelated-histories -s ort -X ours - name: Create initial content PR on pack repo From 06ae2d227f130b53d8b07ea4fffa393b75d3ee23 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sun, 2 Jan 2022 14:44:46 -0600 Subject: [PATCH 11/78] gha: use gh pr create --- .github/workflows/bootstrap_pack_from_pr.yaml | 26 +++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index a448e320..ab4abd74 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -84,6 +84,7 @@ jobs: repository: ${{ jobs.bootstrap_pack_repo.outputs.pack_repo }} path: pack fetch-depth: 0 + persist-credentials: false - name: Checkout incubator uses: actions/checkout@v2 @@ -112,9 +113,19 @@ jobs: git checkout -b transfer - name: Copy Incubator PR contents - - name: Commit and Push + - name: Commit - - name: Create initial content PR on pack repo (subdirectory) + - name: Create initial content PR on pack repo + working-directory: pack + shell: bash + # gh handles pushing using the token before creating the PR + run: | + gh pr create \ + --title "Transfer ${{ jobs.extract_pack_details.outputs.pack_name }} pack from Incubator" + --body "\ + Pack: ${{ jobs.extract_pack_details.outputs.pack_name }}\n\ + Description: ${{ jobs.extract_pack_details.outputs.pack_description }}\n\ + Incubator PR: ${{ github.event.issue.html_url }}" - name: Publish status in incubator PR comment # and/or label @@ -130,6 +141,7 @@ jobs: repository: ${{ jobs.bootstrap_pack_repo.outputs.pack_repo }} path: pack fetch-depth: 0 + persist-credentials: false - name: Checkout incubator uses: actions/checkout@v2 @@ -169,5 +181,15 @@ jobs: git pull source HEAD --allow-unrelated-histories -s ort -X ours - name: Create initial content PR on pack repo + working-directory: pack + shell: bash + # gh handles pushing using the token before creating the PR + run: | + gh pr create \ + --title "Transfer ${{ jobs.extract_pack_details.outputs.pack_name }} pack from Incubator" + --body "\ + Pack: ${{ jobs.extract_pack_details.outputs.pack_name }}\n\ + Description: ${{ jobs.extract_pack_details.outputs.pack_description }}\n\ + Incubator PR: ${{ github.event.issue.html_url }}" - name: Publish status in incubator PR comment # and/or label From 515f7bdd97fa21acd7d1f7cc006fa7f070168940 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 5 Jan 2022 09:34:46 -0600 Subject: [PATCH 12/78] use git-filter-branch --- .github/workflows/bootstrap_pack_from_pr.yaml | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index ab4abd74..a5049ca6 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -78,6 +78,19 @@ jobs: if: jobs.extract_pack_details.outputs.in_submodule == 'false' runs-on: ubuntu-latest steps: + - name: Setup environment + shell: bash + run: | + echo "$HOME/.local/bin" >> $GITHUB_PATH + + - name: Install git-filter-branch + # yes, this is only one python file. instructions say to put it on the PATH. + shell: bash + run: | + mkdir -p ${HOME}/.local/bin + curl https://raw.githubusercontent.com/newren/git-filter-repo/v2.34.0/git-filter-repo -o ${HOME}/.local/bin/git-filter-repo + chmod +x ${HOME}/.local/bin/git-filter-repo + - name: Checkout pack repo uses: actions/checkout@v2 with: @@ -99,6 +112,18 @@ jobs: git fetch origin pull/${{ github.event.issue.number }}/head:pr git checkout pr + # for git-filter-branch usage see: + # https://www.mankier.com/1/git-filter-repo + + - name: Move pack to root of repo + working-directory: incubator + shell: bash + run: | + PACK_DIR=$( + realpath --relative-to="${PWD}" '${{ jobs.extract_pack_details.outputs.pack_path }}' + ) + git-filter-branch --sudirectory-filter "${PACK_DIR}" + - name: Add incubator as git remote working-directory: pack shell: bash @@ -112,8 +137,15 @@ jobs: run: | git checkout -b transfer - - name: Copy Incubator PR contents - - name: Commit + - name: Pull source history into pack repo + working-directory: pack + shell: bash + # ort strategy replaces recursive strategy on git 2.33+ + # ours => Fix merge conflicts by preferring exchange-provided files + # (which should be a minimal required set of files). + # Update the PR before merging if needed. + run: | + git pull source HEAD --allow-unrelated-histories -s ort -X ours - name: Create initial content PR on pack repo working-directory: pack From f7a029eb8340b14907e8d304bb33d936ee5567d8 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 5 Jan 2022 09:49:56 -0600 Subject: [PATCH 13/78] combine jobs --- .github/workflows/bootstrap_pack_from_pr.yaml | 73 +++---------------- 1 file changed, 11 insertions(+), 62 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index a5049ca6..00d97fda 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -72,22 +72,24 @@ jobs: pack_name: ${{ jobs.extract_pack_details.outputs.pack_ref || jobs.extract_pack_details.outputs.pack_name }} pack_description: ${{ jobs.extract_pack_details.outputs.pack_description }} - # based on https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-923614663 - create_pack_pr_from_subdirectory: + # based on + # https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-923614663 + # https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-281247786 + create_pack_pr: needs: [extract_pack_details, bootstrap_pack] - if: jobs.extract_pack_details.outputs.in_submodule == 'false' runs-on: ubuntu-latest steps: - name: Setup environment shell: bash run: | + mkdir -p ${HOME}/.local/bin echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install git-filter-branch + if: jobs.extract_pack_details.outputs.in_submodule == 'false' # yes, this is only one python file. instructions say to put it on the PATH. shell: bash run: | - mkdir -p ${HOME}/.local/bin curl https://raw.githubusercontent.com/newren/git-filter-repo/v2.34.0/git-filter-repo -o ${HOME}/.local/bin/git-filter-repo chmod +x ${HOME}/.local/bin/git-filter-repo @@ -111,11 +113,14 @@ jobs: run: | git fetch origin pull/${{ github.event.issue.number }}/head:pr git checkout pr + git submodule init + git submodule update --remote # for git-filter-branch usage see: # https://www.mankier.com/1/git-filter-repo - name: Move pack to root of repo + if: jobs.extract_pack_details.outputs.in_submodule == 'false' working-directory: incubator shell: bash run: | @@ -125,71 +130,15 @@ jobs: git-filter-branch --sudirectory-filter "${PACK_DIR}" - name: Add incubator as git remote + if: jobs.extract_pack_details.outputs.in_submodule == 'false' working-directory: pack shell: bash run: | git remote add source ../incubator git fetch source - - name: Create branch for initial pack content - working-directory: pack - shell: bash - run: | - git checkout -b transfer - - - name: Pull source history into pack repo - working-directory: pack - shell: bash - # ort strategy replaces recursive strategy on git 2.33+ - # ours => Fix merge conflicts by preferring exchange-provided files - # (which should be a minimal required set of files). - # Update the PR before merging if needed. - run: | - git pull source HEAD --allow-unrelated-histories -s ort -X ours - - - name: Create initial content PR on pack repo - working-directory: pack - shell: bash - # gh handles pushing using the token before creating the PR - run: | - gh pr create \ - --title "Transfer ${{ jobs.extract_pack_details.outputs.pack_name }} pack from Incubator" - --body "\ - Pack: ${{ jobs.extract_pack_details.outputs.pack_name }}\n\ - Description: ${{ jobs.extract_pack_details.outputs.pack_description }}\n\ - Incubator PR: ${{ github.event.issue.html_url }}" - - - name: Publish status in incubator PR comment # and/or label - - # based on https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-281247786 - create_pack_pr_from_submodule: - needs: [extract_pack_details, bootstrap_pack] - if: jobs.extract_pack_details.outputs.in_submodule == 'true' - runs-on: ubuntu-latest - steps: - - name: Checkout pack repo - uses: actions/checkout@v2 - with: - repository: ${{ jobs.bootstrap_pack_repo.outputs.pack_repo }} - path: pack - fetch-depth: 0 - persist-credentials: false - - - name: Checkout incubator - uses: actions/checkout@v2 - with: - path: incubator - fetch-depth: 0 - - - name: Checkout Incubator PR and Submodules - shell: bash - run: | - git fetch origin pull/${{ github.event.issue.number }}/head:pr - git checkout pr - git submodule init - git submodule update --remote - - name: Add git remote for source repo in incubator submodule + if: jobs.extract_pack_details.outputs.in_submodule == 'true' working-directory: pack shell: bash run: | From 6692fc1af1f9d05c432e55c3542088cd23ba000e Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Sun, 9 Jan 2022 17:21:07 -0600 Subject: [PATCH 14/78] add gh api calls to validate PR status --- .github/workflows/bootstrap_pack_from_pr.yaml | 63 ++++++++++++++++--- 1 file changed, 56 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 00d97fda..2d5deef8 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -19,26 +19,74 @@ on: # env.SLACK_WEBHOOK_URL jobs: - tsc_membership_check: + permissions_check: # "!bootstrap pack" comment on pull requests - if: github.event.comment.body == '!bootstrap pack' && github.event.issue.pull_request - + if: >- + github.event.issue.pull_request + && contains( + ['OWNER', 'MEMBER', 'COLLABORATOR'], + github.event.comment.author_association + ) + && github.event.comment.body == '!bootstrap pack' + # author_association enum def + # https://docs.github.com/en/graphql/reference/enums#commentauthorassociation + runs-on: ubuntu-latest steps: - - name: Validate commentor permissions - # must be a TSC member + # the commentator has write access to the incubator + # so no more group membership validation required. + - name: Add allowed emoji reaction + # maybe one of these + :unlock: 🔓 + :key: 🗝️ + :inbox_tray: 📥 + :outbox_tray: 📤 + :heavy_check_mark: ✔️ + :gear: ⚙️ + :robot: 🤖 + :yellow_circle: 🟡 ready_to_merge_check: - needs: [tsc_membership_check] + needs: [permissions_check] runs-on: ubuntu-latest steps: - name: Make sure incubator PR is approved + shell: bash + run: >- + [[ $(gh api /repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}/reviews + --jq '[.[] | + select(.author_association=="OWNER" or .author_association=="COLLABORATOR") | + select(.state=="APPROVED" or .state=="CHANGES_REQUESTED") | + .state == "APPROVED"] | (.|all) and (.|length>0)' + ) == "true" ]] + - name: Make sure CI workflow is passing for PR + shell: bash + run: | + [[ $(gh api graphql \ + -F owner=${{ github.repository_owner }} \ + -F repo=${{ github.event.repository.name }} \ + -F pull_number=${{ github.event.issue.number }} \ + 'query($owner: String!, $repo: String!, $pull_number: Int!) { + repository(owner: $owner, name:$repo) { + pullRequest(number:$pull_number) { + commits(last: 1) { + nodes { + commit { + statusCheckRollup { + state + } + } + } + } + } + } + }') == "true" ]] - name: Publish status in incubator PR comment # and/or label extract_pack_details: - needs: [tsc_membership_check, ready_to_merge_check] + needs: [permissions_check, ready_to_merge_check] runs-on: ubuntu-latest steps: - name: Extract Pack Details @@ -64,6 +112,7 @@ jobs: name: New Pack # / Bootstrap Repo # TODO: switch from @gha to @master uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha + # TODO: setup protected branch with required pr review and checks with: # secrets admin_token: "" # TODO: admin PAT with scopes: public_repo, workflows, org:write From 0db46b7f9f052e772f4311aabe4e3d81bdd8a537 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Mon, 10 Jan 2022 10:35:45 -0600 Subject: [PATCH 15/78] add reaction/status tasks for happy path --- .github/workflows/bootstrap_pack_from_pr.yaml | 27 +++++++++++-------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 2d5deef8..46274cee 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -35,16 +35,10 @@ jobs: steps: # the commentator has write access to the incubator # so no more group membership validation required. - - name: Add allowed emoji reaction - # maybe one of these - :unlock: 🔓 - :key: 🗝️ - :inbox_tray: 📥 - :outbox_tray: 📤 - :heavy_check_mark: ✔️ - :gear: ⚙️ - :robot: 🤖 - :yellow_circle: 🟡 + - name: Add eyes emoji reaction to say inspecting PR + shell: bash + run: | + gh api -f content=eyes /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions ready_to_merge_check: needs: [permissions_check] @@ -83,6 +77,12 @@ jobs: } }') == "true" ]] + - name: Mark running with rocket reaction and label + shell: bash + run: | + gh api -X POST -f content=rocket /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions + jq -n '{"labels": ["bootstrap:in-progress"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels -- - + - name: Publish status in incubator PR comment # and/or label extract_pack_details: @@ -222,4 +222,9 @@ jobs: Description: ${{ jobs.extract_pack_details.outputs.pack_description }}\n\ Incubator PR: ${{ github.event.issue.html_url }}" - - name: Publish status in incubator PR comment # and/or label + - name: Mark running with hooray reaction and label + shell: bash + run: | + gh api -X POST -f content=hooray /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions + jq -n '{"labels": ["bootstrap:complete"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels -- - + gh api -X DELETE /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels/bootstrap:in-progress From e751cb57f4a306b7bd9f8ec4ef32e1673d91d510 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Mon, 10 Jan 2022 11:54:13 -0600 Subject: [PATCH 16/78] correct git-filter-repo usage --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 46274cee..7bf3fff5 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -165,7 +165,7 @@ jobs: git submodule init git submodule update --remote - # for git-filter-branch usage see: + # for git-filter-repo usage see: # https://www.mankier.com/1/git-filter-repo - name: Move pack to root of repo @@ -176,7 +176,7 @@ jobs: PACK_DIR=$( realpath --relative-to="${PWD}" '${{ jobs.extract_pack_details.outputs.pack_path }}' ) - git-filter-branch --sudirectory-filter "${PACK_DIR}" + git-filter-repo --sudirectory-filter "${PACK_DIR}" --force - name: Add incubator as git remote if: jobs.extract_pack_details.outputs.in_submodule == 'false' From bc97d33939b754843dd7f69f18677fc1a9da8db1 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Mon, 10 Jan 2022 11:55:12 -0600 Subject: [PATCH 17/78] use git merge instead of git pull git pull did nothing because it could not find a common ancestor --- .github/workflows/bootstrap_pack_from_pr.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 7bf3fff5..28903a9a 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -208,7 +208,8 @@ jobs: # (which should be a minimal required set of files). # Update the PR before merging if needed. run: | - git pull source HEAD --allow-unrelated-histories -s ort -X ours + git merge source/pr --allow-unrelated-histories -s ort -X ours \ + -m 'Merge ${{ github.event.issue.html_url }}' - name: Create initial content PR on pack repo working-directory: pack From ed161f1981d77274878eda88e86fa2c2f8efa9b2 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Mon, 10 Jan 2022 11:55:40 -0600 Subject: [PATCH 18/78] try setting gh config to avoid gh push prompt --- .github/workflows/bootstrap_pack_from_pr.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 28903a9a..59d7e838 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -216,6 +216,7 @@ jobs: shell: bash # gh handles pushing using the token before creating the PR run: | + git config set remote.origin.gh-resolved base gh pr create \ --title "Transfer ${{ jobs.extract_pack_details.outputs.pack_name }} pack from Incubator" --body "\ From d07b27d1a21c63e0f0afb5ec49d11aca254f7c57 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 20:51:23 -0500 Subject: [PATCH 19/78] drop add_pack_maintainers workflow --- .github/workflows/add_pack_maintainers.yaml | 43 --------------------- 1 file changed, 43 deletions(-) delete mode 100644 .github/workflows/add_pack_maintainers.yaml diff --git a/.github/workflows/add_pack_maintainers.yaml b/.github/workflows/add_pack_maintainers.yaml deleted file mode 100644 index 26cc4002..00000000 --- a/.github/workflows/add_pack_maintainers.yaml +++ /dev/null @@ -1,43 +0,0 @@ -name: Add Pack Maintainers - -on: - issue_comment: - types: created - -jobs: - tsc_membership_check: - # "!add pack maintainers ..." comment on pull requests - if: startsWith(github.event.comment.body, '!add pack maintainers') && github.event.issue.pull_request - - runs-on: ubuntu-latest - steps: - - name: Validate commentor permissions - # must be a TSC member - - repo_is_ready_check: - needs: [tsc_membership_check] - runs-on: ubuntu-latest - steps: - - name: Make sure incubator PR is approved - - name: Make sure pack repo is bootstrapped - - - name: Publish status in incubator PR comment # and/or label - - bootstrap_pack_repo: - needs: [tsc_membership_check, repo_is_ready_check] - runs-on: ubuntu-latest - steps: - - name: Parse comment to get maintainer details - # output needs-team - - - name: Add team - if: needs-team - - name: Add maintainers to team - if: needs-team - - name: Add team to repo - if: needs-team - - - name: Add maintainers to repo - if: ! needs-team - - - name: Publish status in incubator PR comment # and/or label From d5f13fcb03c3f94e6dbc6acf852deca5b9797082 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 21:36:28 -0500 Subject: [PATCH 20/78] gha: add bootstrap pr comment --- .github/workflows/bootstrap_pack_from_pr.yaml | 28 +++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 59d7e838..f074b70b 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -30,7 +30,6 @@ jobs: && github.event.comment.body == '!bootstrap pack' # author_association enum def # https://docs.github.com/en/graphql/reference/enums#commentauthorassociation - runs-on: ubuntu-latest steps: # the commentator has write access to the incubator @@ -83,7 +82,16 @@ jobs: gh api -X POST -f content=rocket /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions jq -n '{"labels": ["bootstrap:in-progress"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels -- - - - name: Publish status in incubator PR comment # and/or label + - name: Publish status in incubator PR comment + shell: bash + run: > + gh pr comment "{{ github.event.issue.html_url }}" + --body ":rocket: Hold onto your hats! Now bootstrapping a new pack repo...\n\n + Bootstrapping will:\n + (1) extract details about the new pack;\n + (2) create the pack repo and repo metadata;\n + (3) copy this PR into the `transfer` branch in the new repo;\n + (4) use `transfer` branch for the pack's first PR." extract_pack_details: needs: [permissions_check, ready_to_merge_check] @@ -230,3 +238,19 @@ jobs: gh api -X POST -f content=hooray /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions jq -n '{"labels": ["bootstrap:complete"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels -- - gh api -X DELETE /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels/bootstrap:in-progress + + - name: Publish status in incubator PR comment + shell: bash + run: > + gh pr comment "{{ github.event.issue.html_url }}" + -b ":tada: Hoooray, the initial content PR ( + https://github.com/${{ jobs.bootstrap_pack_repo.outputs.pack_repo }}/pull/1 + ) is ready for review!\n\n + Please do the following:\n + (1) make sure everything looks correct in the PR;\n + (2) merge it!\n + (3) make sure a TSC Senior Maintainer has setup group and user access;\n + (4) wait for the next exchange index update (monitor updates + [here](https://github.com/StackStorm-Exchange/index/actions))\n + (5) once the index has updated, check out + https://exchange.stackstorm.org/#${{ jobs.extract_pack_details.outputs.pack_name }}" From bd134d7f4e05adf8d372c08c60cb0e7c5546def2 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 21:46:43 -0500 Subject: [PATCH 21/78] clarify var requirements --- .github/workflows/bootstrap_pack_from_pr.yaml | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index f074b70b..354949da 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -8,15 +8,9 @@ on: issue_comment: types: created -# need vars: -# env.PACK_ORG: StackStorm-Exchange -# env.PACK_REPO_PREFIX: stackstorm -# env.PACK_REPO_TEMPLATE: StackStorm-Exchange/exchange-template -# env.TSC_TEAM: TSC -# -# need secrets: -# env.GH_TOKEN: admin bot PAT w/ scopes public_repo, workflow, write:org -# env.SLACK_WEBHOOK_URL +# need secrets for bootstrap_pack_repo job: +# admin_token: admin bot PAT w/ scopes public_repo, workflow, write:org +# slack_webhook_url jobs: permissions_check: @@ -125,10 +119,18 @@ jobs: # secrets admin_token: "" # TODO: admin PAT with scopes: public_repo, workflows, org:write slack_webhook_url: "" # TODO + # TODO: validate that this || works as expected pack_name: ${{ jobs.extract_pack_details.outputs.pack_ref || jobs.extract_pack_details.outputs.pack_name }} pack_description: ${{ jobs.extract_pack_details.outputs.pack_description }} + # we are using defaults for these. + #homepage: "https://exchange.stackstorm.com/#${PACK_NAME}" + #pack_org: StackStorm-Exchange + #pack_repo_prefix: stackstorm + #pack_repo_template: StackStorm-Exchange/ci-pack-template + #tsc_team: TSC + # based on # https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-923614663 # https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-281247786 From 6345b63e048a8dba487ae39dbc5ddc7bce0ef019 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 22:23:35 -0500 Subject: [PATCH 22/78] update gh api call --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 354949da..62c2bab0 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -31,7 +31,7 @@ jobs: - name: Add eyes emoji reaction to say inspecting PR shell: bash run: | - gh api -f content=eyes /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions + gh api -X POST -f content=eyes /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions ready_to_merge_check: needs: [permissions_check] From 20eab18c96ca53db8bc4e8f4c3330c7830cf5167 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 22:45:47 -0500 Subject: [PATCH 23/78] fix context name jobs->needs --- .github/workflows/bootstrap_pack_from_pr.yaml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 62c2bab0..66e64251 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -121,8 +121,8 @@ jobs: slack_webhook_url: "" # TODO # TODO: validate that this || works as expected - pack_name: ${{ jobs.extract_pack_details.outputs.pack_ref || jobs.extract_pack_details.outputs.pack_name }} - pack_description: ${{ jobs.extract_pack_details.outputs.pack_description }} + pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} + pack_description: ${{ needs.extract_pack_details.outputs.pack_description }} # we are using defaults for these. #homepage: "https://exchange.stackstorm.com/#${PACK_NAME}" @@ -145,7 +145,7 @@ jobs: echo "$HOME/.local/bin" >> $GITHUB_PATH - name: Install git-filter-branch - if: jobs.extract_pack_details.outputs.in_submodule == 'false' + if: needs.extract_pack_details.outputs.in_submodule == 'false' # yes, this is only one python file. instructions say to put it on the PATH. shell: bash run: | @@ -155,7 +155,7 @@ jobs: - name: Checkout pack repo uses: actions/checkout@v2 with: - repository: ${{ jobs.bootstrap_pack_repo.outputs.pack_repo }} + repository: ${{ needs.bootstrap_pack_repo.outputs.pack_repo }} path: pack fetch-depth: 0 persist-credentials: false @@ -179,17 +179,17 @@ jobs: # https://www.mankier.com/1/git-filter-repo - name: Move pack to root of repo - if: jobs.extract_pack_details.outputs.in_submodule == 'false' + if: needs.extract_pack_details.outputs.in_submodule == 'false' working-directory: incubator shell: bash run: | PACK_DIR=$( - realpath --relative-to="${PWD}" '${{ jobs.extract_pack_details.outputs.pack_path }}' + realpath --relative-to="${PWD}" '${{ needs.extract_pack_details.outputs.pack_path }}' ) git-filter-repo --sudirectory-filter "${PACK_DIR}" --force - name: Add incubator as git remote - if: jobs.extract_pack_details.outputs.in_submodule == 'false' + if: needs.extract_pack_details.outputs.in_submodule == 'false' working-directory: pack shell: bash run: | @@ -197,11 +197,11 @@ jobs: git fetch source - name: Add git remote for source repo in incubator submodule - if: jobs.extract_pack_details.outputs.in_submodule == 'true' + if: needs.extract_pack_details.outputs.in_submodule == 'true' working-directory: pack shell: bash run: | - git remote add source ${{ jobs.extract_pack_details.outputs.pack_path }} + git remote add source ${{ needs.extract_pack_details.outputs.pack_path }} git fetch source - name: Create branch for initial pack content @@ -228,10 +228,10 @@ jobs: run: | git config set remote.origin.gh-resolved base gh pr create \ - --title "Transfer ${{ jobs.extract_pack_details.outputs.pack_name }} pack from Incubator" + --title "Transfer ${{ needs.extract_pack_details.outputs.pack_name }} pack from Incubator" --body "\ - Pack: ${{ jobs.extract_pack_details.outputs.pack_name }}\n\ - Description: ${{ jobs.extract_pack_details.outputs.pack_description }}\n\ + Pack: ${{ needs.extract_pack_details.outputs.pack_name }}\n\ + Description: ${{ needs.extract_pack_details.outputs.pack_description }}\n\ Incubator PR: ${{ github.event.issue.html_url }}" - name: Mark running with hooray reaction and label @@ -246,7 +246,7 @@ jobs: run: > gh pr comment "{{ github.event.issue.html_url }}" -b ":tada: Hoooray, the initial content PR ( - https://github.com/${{ jobs.bootstrap_pack_repo.outputs.pack_repo }}/pull/1 + https://github.com/${{ needs.bootstrap_pack_repo.outputs.pack_repo }}/pull/1 ) is ready for review!\n\n Please do the following:\n (1) make sure everything looks correct in the PR;\n @@ -255,4 +255,4 @@ jobs: (4) wait for the next exchange index update (monitor updates [here](https://github.com/StackStorm-Exchange/index/actions))\n (5) once the index has updated, check out - https://exchange.stackstorm.org/#${{ jobs.extract_pack_details.outputs.pack_name }}" + https://exchange.stackstorm.org/#${{ needs.extract_pack_details.outputs.pack_name }}" From 8af2414971f5301959bcc413426078dc708f559c Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 22:56:20 -0500 Subject: [PATCH 24/78] gha expressions do not support array literals --- .github/workflows/bootstrap_pack_from_pr.yaml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 66e64251..3b6abe4d 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -17,9 +17,10 @@ jobs: # "!bootstrap pack" comment on pull requests if: >- github.event.issue.pull_request - && contains( - ['OWNER', 'MEMBER', 'COLLABORATOR'], - github.event.comment.author_association + && ( + github.event.comment.author_association == 'OWNER' + || github.event.comment.author_association == 'MEMBER' + || github.event.comment.author_association == 'COLLABORATOR' ) && github.event.comment.body == '!bootstrap pack' # author_association enum def From fa328f34313be82264d2a4e5f81cd9bac96ea9ce Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 22:58:36 -0500 Subject: [PATCH 25/78] fix job name --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 3b6abe4d..6435d5f1 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -136,7 +136,7 @@ jobs: # https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-923614663 # https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-281247786 create_pack_pr: - needs: [extract_pack_details, bootstrap_pack] + needs: [extract_pack_details, bootstrap_pack_repo] runs-on: ubuntu-latest steps: - name: Setup environment From 2a489a3697a297f039ddcd27f2b28f915e44d8c1 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 23:11:07 -0500 Subject: [PATCH 26/78] try alt secrets syntax --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 6435d5f1..6536e11e 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -116,10 +116,10 @@ jobs: # TODO: switch from @gha to @master uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha # TODO: setup protected branch with required pr review and checks - with: - # secrets + secrets: admin_token: "" # TODO: admin PAT with scopes: public_repo, workflows, org:write slack_webhook_url: "" # TODO + with: # TODO: validate that this || works as expected pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} From d40037ff8a5926d77d948241dcc880157e141e7c Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Tue, 17 May 2022 22:40:40 -0500 Subject: [PATCH 27/78] st2sandbox --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 6536e11e..70c0497a 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -127,8 +127,8 @@ jobs: # we are using defaults for these. #homepage: "https://exchange.stackstorm.com/#${PACK_NAME}" - #pack_org: StackStorm-Exchange - #pack_repo_prefix: stackstorm + pack_org: st2sandbox + pack_repo_prefix: pack #pack_repo_template: StackStorm-Exchange/ci-pack-template #tsc_team: TSC From 6edc422dd207a7934a7f6f6ff46b31516c2bc9b6 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 01:45:27 -0500 Subject: [PATCH 28/78] permissions --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 70c0497a..30d915b3 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -12,6 +12,10 @@ on: # admin_token: admin bot PAT w/ scopes public_repo, workflow, write:org # slack_webhook_url +#permissions: +env: + GH_TOKEN: ${{ github.token }} + jobs: permissions_check: # "!bootstrap pack" comment on pull requests From 16be95bf73aecb84cc116a27fbfd815b733448ce Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 02:15:19 -0500 Subject: [PATCH 29/78] permissions+output --- .github/workflows/bootstrap_pack_from_pr.yaml | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 30d915b3..975de63f 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -12,7 +12,12 @@ on: # admin_token: admin bot PAT w/ scopes public_repo, workflow, write:org # slack_webhook_url -#permissions: +permissions: + issues: write # comments, reactions + pull-requests: read + contents: read + checks: read + statuses: read env: GH_TOKEN: ${{ github.token }} @@ -45,12 +50,15 @@ jobs: - name: Make sure incubator PR is approved shell: bash run: >- - [[ $(gh api /repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}/reviews + export APPROVED=$( + gh api /repos/${{ github.repository }}/pulls/${{ github.event.issue.number }}/reviews --jq '[.[] | select(.author_association=="OWNER" or .author_association=="COLLABORATOR") | select(.state=="APPROVED" or .state=="CHANGES_REQUESTED") | .state == "APPROVED"] | (.|all) and (.|length>0)' - ) == "true" ]] + ) + && echo "APPROVED=${APPROVED}" + && [[ "${APPROVED}" == "true" ]] - name: Make sure CI workflow is passing for PR shell: bash From bb99028170b0168d66b006e29e7b5d8e5376623c Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 02:24:03 -0500 Subject: [PATCH 30/78] permissions --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 975de63f..0d03d490 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -13,8 +13,8 @@ on: # slack_webhook_url permissions: - issues: write # comments, reactions - pull-requests: read + #issues: write # comments + pull-requests: write # comments, reactions contents: read checks: read statuses: read From 14a925895e3edb4da83ba00c05de168ea3e5e461 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 02:38:40 -0500 Subject: [PATCH 31/78] permissions --- .github/workflows/bootstrap_pack_from_pr.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 0d03d490..b887b339 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -13,11 +13,10 @@ on: # slack_webhook_url permissions: - #issues: write # comments pull-requests: write # comments, reactions contents: read - checks: read - statuses: read + #checks: read + #statuses: read env: GH_TOKEN: ${{ github.token }} @@ -58,7 +57,8 @@ jobs: .state == "APPROVED"] | (.|all) and (.|length>0)' ) && echo "APPROVED=${APPROVED}" - && [[ "${APPROVED}" == "true" ]] +# TODO: uncomment +# && [[ "${APPROVED}" == "true" ]] - name: Make sure CI workflow is passing for PR shell: bash From b60109af10da5bfc298bb2117812ee1b0abb60f4 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 02:47:39 -0500 Subject: [PATCH 32/78] permissions --- .github/workflows/bootstrap_pack_from_pr.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index b887b339..dc978598 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -63,7 +63,8 @@ jobs: - name: Make sure CI workflow is passing for PR shell: bash run: | - [[ $(gh api graphql \ + export CIPASSING=$(\ + gh api graphql \ -F owner=${{ github.repository_owner }} \ -F repo=${{ github.event.repository.name }} \ -F pull_number=${{ github.event.issue.number }} \ @@ -81,7 +82,9 @@ jobs: } } } - }') == "true" ]] + }') \ + && echo "CIPASSING=${CIPASSING}" \ + && [[ "${CIPASSING}" == "true" ]] - name: Mark running with rocket reaction and label shell: bash From 89384e84d8f49d301019c3c8e241d0fd322bc8d6 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 11:03:56 -0500 Subject: [PATCH 33/78] fix graphql query --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index dc978598..ba66bc48 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -68,7 +68,7 @@ jobs: -F owner=${{ github.repository_owner }} \ -F repo=${{ github.event.repository.name }} \ -F pull_number=${{ github.event.issue.number }} \ - 'query($owner: String!, $repo: String!, $pull_number: Int!) { + -f query='query($owner: String!, $repo: String!, $pull_number: Int!) { repository(owner: $owner, name:$repo) { pullRequest(number:$pull_number) { commits(last: 1) { From 0167aa41b8a133dda60354cfd3ba7fbbf84d89af Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 11:10:42 -0500 Subject: [PATCH 34/78] fix graphql lookup --- .github/workflows/bootstrap_pack_from_pr.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index ba66bc48..f85e0243 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -82,9 +82,11 @@ jobs: } } } - }') \ + }' \ + --jq '.data.repository.pullRequest.commits.nodes.[].commit.statusCheckRollup.state' \ + ) \ && echo "CIPASSING=${CIPASSING}" \ - && [[ "${CIPASSING}" == "true" ]] + && [[ "${CIPASSING}" == "SUCCESS" ]] - name: Mark running with rocket reaction and label shell: bash From 4612ddf4d29343a2aa88516d82152f6aeb1d103b Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 11:14:49 -0500 Subject: [PATCH 35/78] fix labels --- .github/workflows/bootstrap_pack_from_pr.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index f85e0243..9cb917c3 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -63,7 +63,7 @@ jobs: - name: Make sure CI workflow is passing for PR shell: bash run: | - export CIPASSING=$(\ + export CIRESULT=$(\ gh api graphql \ -F owner=${{ github.repository_owner }} \ -F repo=${{ github.event.repository.name }} \ @@ -85,14 +85,14 @@ jobs: }' \ --jq '.data.repository.pullRequest.commits.nodes.[].commit.statusCheckRollup.state' \ ) \ - && echo "CIPASSING=${CIPASSING}" \ + && echo "CIRESULT=${CIRESULT}" \ && [[ "${CIPASSING}" == "SUCCESS" ]] - name: Mark running with rocket reaction and label shell: bash run: | gh api -X POST -f content=rocket /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions - jq -n '{"labels": ["bootstrap:in-progress"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels -- - + jq -n '{"labels": ["bootstrap:in-progress"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels --input - - name: Publish status in incubator PR comment shell: bash @@ -256,7 +256,7 @@ jobs: shell: bash run: | gh api -X POST -f content=hooray /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions - jq -n '{"labels": ["bootstrap:complete"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels -- - + jq -n '{"labels": ["bootstrap:complete"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels --input - gh api -X DELETE /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels/bootstrap:in-progress - name: Publish status in incubator PR comment From be051e241fef1c2ab7997ce5d9dba5d4d033649b Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 11:50:05 -0500 Subject: [PATCH 36/78] typo fix --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 9cb917c3..dc98b97b 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -86,7 +86,7 @@ jobs: --jq '.data.repository.pullRequest.commits.nodes.[].commit.statusCheckRollup.state' \ ) \ && echo "CIRESULT=${CIRESULT}" \ - && [[ "${CIPASSING}" == "SUCCESS" ]] + && [[ "${CIRESULT}" == "SUCCESS" ]] - name: Mark running with rocket reaction and label shell: bash From 32893c21b5dd6227b357ac080821e5f6260f8614 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 11:52:06 -0500 Subject: [PATCH 37/78] fix bash quotes --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index dc98b97b..b767fb32 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -98,12 +98,12 @@ jobs: shell: bash run: > gh pr comment "{{ github.event.issue.html_url }}" - --body ":rocket: Hold onto your hats! Now bootstrapping a new pack repo...\n\n + --body ':rocket: Hold onto your hats! Now bootstrapping a new pack repo...\n\n Bootstrapping will:\n (1) extract details about the new pack;\n (2) create the pack repo and repo metadata;\n (3) copy this PR into the `transfer` branch in the new repo;\n - (4) use `transfer` branch for the pack's first PR." + (4) use `transfer` branch for the pack's first PR.' extract_pack_details: needs: [permissions_check, ready_to_merge_check] From 3b3b8c9cb107bae444bd840bad5d8a9f6fd2634a Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 11:54:37 -0500 Subject: [PATCH 38/78] fix bash quotes --- .github/workflows/bootstrap_pack_from_pr.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index b767fb32..62b63eed 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -96,13 +96,13 @@ jobs: - name: Publish status in incubator PR comment shell: bash - run: > - gh pr comment "{{ github.event.issue.html_url }}" - --body ':rocket: Hold onto your hats! Now bootstrapping a new pack repo...\n\n - Bootstrapping will:\n - (1) extract details about the new pack;\n - (2) create the pack repo and repo metadata;\n - (3) copy this PR into the `transfer` branch in the new repo;\n + run: | + gh pr comment "{{ github.event.issue.html_url }}"\ + --body ':rocket: Hold onto your hats! Now bootstrapping a new pack repo...\n\n\ + Bootstrapping will:\n\ + (1) extract details about the new pack;\n\ + (2) create the pack repo and repo metadata;\n\ + (3) copy this PR into the `transfer` branch in the new repo;\n\ (4) use `transfer` branch for the pack's first PR.' extract_pack_details: From 5d8f558b6f9301774d4ab14f08b88f645f1671fb Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 12:02:43 -0500 Subject: [PATCH 39/78] better quoting --- .github/workflows/bootstrap_pack_from_pr.yaml | 28 +++++++++---------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 62b63eed..7b9160c6 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -96,13 +96,13 @@ jobs: - name: Publish status in incubator PR comment shell: bash - run: | - gh pr comment "{{ github.event.issue.html_url }}"\ - --body ':rocket: Hold onto your hats! Now bootstrapping a new pack repo...\n\n\ - Bootstrapping will:\n\ - (1) extract details about the new pack;\n\ - (2) create the pack repo and repo metadata;\n\ - (3) copy this PR into the `transfer` branch in the new repo;\n\ + run: >- + gh pr comment '${{ github.event.issue.html_url }}' + --body ':rocket: Hold onto your hats! Now bootstrapping a new pack repo...\n\n + Bootstrapping will:\n + (1) extract details about the new pack;\n + (2) create the pack repo and repo metadata;\n + (3) copy this PR into the `transfer` branch in the new repo;\n (4) use `transfer` branch for the pack's first PR.' extract_pack_details: @@ -246,11 +246,11 @@ jobs: run: | git config set remote.origin.gh-resolved base gh pr create \ - --title "Transfer ${{ needs.extract_pack_details.outputs.pack_name }} pack from Incubator" - --body "\ + --title 'Transfer ${{ needs.extract_pack_details.outputs.pack_name }} pack from Incubator' + --body '\ Pack: ${{ needs.extract_pack_details.outputs.pack_name }}\n\ Description: ${{ needs.extract_pack_details.outputs.pack_description }}\n\ - Incubator PR: ${{ github.event.issue.html_url }}" + Incubator PR: ${{ github.event.issue.html_url }}' - name: Mark running with hooray reaction and label shell: bash @@ -261,9 +261,9 @@ jobs: - name: Publish status in incubator PR comment shell: bash - run: > - gh pr comment "{{ github.event.issue.html_url }}" - -b ":tada: Hoooray, the initial content PR ( + run: >- + gh pr comment '${{ github.event.issue.html_url }}' + -b ':tada: Hoooray, the initial content PR ( https://github.com/${{ needs.bootstrap_pack_repo.outputs.pack_repo }}/pull/1 ) is ready for review!\n\n Please do the following:\n @@ -273,4 +273,4 @@ jobs: (4) wait for the next exchange index update (monitor updates [here](https://github.com/StackStorm-Exchange/index/actions))\n (5) once the index has updated, check out - https://exchange.stackstorm.org/#${{ needs.extract_pack_details.outputs.pack_name }}" + https://exchange.stackstorm.org/#${{ needs.extract_pack_details.outputs.pack_name }}' From 31826240a686aba935beee29d02bef89e2c281c7 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 12:05:06 -0500 Subject: [PATCH 40/78] quote escaping --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 7b9160c6..3b154872 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -103,7 +103,7 @@ jobs: (1) extract details about the new pack;\n (2) create the pack repo and repo metadata;\n (3) copy this PR into the `transfer` branch in the new repo;\n - (4) use `transfer` branch for the pack's first PR.' + (4) use `transfer` branch for the pack'"'"'s first PR.' extract_pack_details: needs: [permissions_check, ready_to_merge_check] From 80cc752429c85afdf251bcf05693304bf775d739 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 12:12:03 -0500 Subject: [PATCH 41/78] reformat comment --- .github/workflows/bootstrap_pack_from_pr.yaml | 47 +++++++++++-------- 1 file changed, 27 insertions(+), 20 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 3b154872..3b936934 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -96,14 +96,17 @@ jobs: - name: Publish status in incubator PR comment shell: bash - run: >- - gh pr comment '${{ github.event.issue.html_url }}' - --body ':rocket: Hold onto your hats! Now bootstrapping a new pack repo...\n\n - Bootstrapping will:\n - (1) extract details about the new pack;\n - (2) create the pack repo and repo metadata;\n - (3) copy this PR into the `transfer` branch in the new repo;\n - (4) use `transfer` branch for the pack'"'"'s first PR.' + run: | + gh pr comment '${{ github.event.issue.html_url }}'\ + --body "$(cat <- - gh pr comment '${{ github.event.issue.html_url }}' - -b ':tada: Hoooray, the initial content PR ( - https://github.com/${{ needs.bootstrap_pack_repo.outputs.pack_repo }}/pull/1 - ) is ready for review!\n\n - Please do the following:\n - (1) make sure everything looks correct in the PR;\n - (2) merge it!\n - (3) make sure a TSC Senior Maintainer has setup group and user access;\n - (4) wait for the next exchange index update (monitor updates - [here](https://github.com/StackStorm-Exchange/index/actions))\n - (5) once the index has updated, check out + run: | + gh pr comment '${{ github.event.issue.html_url }}' \ + --body "$(cat < Date: Wed, 18 May 2022 12:19:47 -0500 Subject: [PATCH 42/78] move COMMENT def --- .github/workflows/bootstrap_pack_from_pr.yaml | 50 +++++++++---------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 3b936934..1049b042 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -96,17 +96,16 @@ jobs: - name: Publish status in incubator PR comment shell: bash + env: + COMMENT: | + :rocket: Hold onto your hats! Now bootstrapping a new pack repo... + Bootstrapping will: + (1) extract details about the new pack; + (2) create the pack repo and repo metadata; + (3) copy this PR into the `transfer` branch in the new repo; + (4) use `transfer` branch for the pack's first PR. run: | - gh pr comment '${{ github.event.issue.html_url }}'\ - --body "$(cat < Date: Wed, 18 May 2022 12:22:17 -0500 Subject: [PATCH 43/78] fix action ref --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 1049b042..af1fe91b 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -114,7 +114,7 @@ jobs: - name: Extract Pack Details id: pack-details # TODO: switch from @gha to @master - uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta.yaml@gha + uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta@gha with: pack-directory: incubator repository: ${{ github.repository }} From c3a7c65bc3e23e2a0ea61c2bb5c4125472255523 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 13:53:03 -0500 Subject: [PATCH 44/78] try alt ref --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index af1fe91b..5e623172 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -119,7 +119,7 @@ jobs: pack-directory: incubator repository: ${{ github.repository }} # expects an issue_comment event - ref: pull/${{ github.event.issue.number }}/head + ref: refs/pull/${{ github.event.issue.number }}/head fetch-depth: 0 outputs: pack_name: ${{ steps.pack-details.outputs.pack_name }} From 2bdcf948e5fa8137a280e027ee80f24a140e0ab6 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 14:00:53 -0500 Subject: [PATCH 45/78] try token --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 5e623172..141242d2 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -136,7 +136,7 @@ jobs: uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha # TODO: setup protected branch with required pr review and checks secrets: - admin_token: "" # TODO: admin PAT with scopes: public_repo, workflows, org:write + admin_token: ${{ github.token }} # TODO: admin PAT with scopes: public_repo, workflows, org:write slack_webhook_url: "" # TODO with: From 89ad7796dcffcb70e81755a931b003420dd451b8 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 16:23:39 -0500 Subject: [PATCH 46/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 141242d2..9519f3ec 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -129,6 +129,21 @@ jobs: in_submodule: ${{ steps.pack-details.outputs.in_submodule }} in_subdir: ${{ steps.pack-details.outputs.in_subdir }} + print_pack_details: + needs: [extract_pack_details] + runs-on: ubuntu-latest + steps: + - name: Print pack details + shell: bash + run: | + echo 'pack_ref=${{ needs.extract_pack_details.outputs.pack_ref }}' + echo 'pack_name=${{ needs.extract_pack_details.outputs.pack_name }}' + echo 'pack_ref||pack_name=${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }}" + echo 'pack_description=${{ needs.extract_pack_details.outputs.pack_description }}' + echo 'pack_path=${{ needs.extract_pack_details.outputs.pack_path }}' + echo 'in_submodule=${{ needs.extract_pack_details.outputs.in_submodule }}' + echo 'in_subdir=${{ needs.extract_pack_details.outputs.in_subdir }}' + bootstrap_pack_repo: needs: [extract_pack_details] name: New Pack # / Bootstrap Repo From b163bceca75bd14bc6d6200b15d57e691729bb11 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 16:32:33 -0500 Subject: [PATCH 47/78] quote --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 9519f3ec..6dd05eea 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -138,7 +138,7 @@ jobs: run: | echo 'pack_ref=${{ needs.extract_pack_details.outputs.pack_ref }}' echo 'pack_name=${{ needs.extract_pack_details.outputs.pack_name }}' - echo 'pack_ref||pack_name=${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }}" + echo 'pack_ref||pack_name=${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }}' echo 'pack_description=${{ needs.extract_pack_details.outputs.pack_description }}' echo 'pack_path=${{ needs.extract_pack_details.outputs.pack_path }}' echo 'in_submodule=${{ needs.extract_pack_details.outputs.in_submodule }}' From 55f7c645193575893b7f7e4abd70fb91edc1e860 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 16:56:21 -0500 Subject: [PATCH 48/78] drop debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 15 --------------- 1 file changed, 15 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 6dd05eea..141242d2 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -129,21 +129,6 @@ jobs: in_submodule: ${{ steps.pack-details.outputs.in_submodule }} in_subdir: ${{ steps.pack-details.outputs.in_subdir }} - print_pack_details: - needs: [extract_pack_details] - runs-on: ubuntu-latest - steps: - - name: Print pack details - shell: bash - run: | - echo 'pack_ref=${{ needs.extract_pack_details.outputs.pack_ref }}' - echo 'pack_name=${{ needs.extract_pack_details.outputs.pack_name }}' - echo 'pack_ref||pack_name=${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }}' - echo 'pack_description=${{ needs.extract_pack_details.outputs.pack_description }}' - echo 'pack_path=${{ needs.extract_pack_details.outputs.pack_path }}' - echo 'in_submodule=${{ needs.extract_pack_details.outputs.in_submodule }}' - echo 'in_subdir=${{ needs.extract_pack_details.outputs.in_subdir }}' - bootstrap_pack_repo: needs: [extract_pack_details] name: New Pack # / Bootstrap Repo From 41d503e39b0faa023ceb1216474d82d01761be80 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 16:59:06 -0500 Subject: [PATCH 49/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 141242d2..38de562f 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -136,7 +136,7 @@ jobs: uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha # TODO: setup protected branch with required pr review and checks secrets: - admin_token: ${{ github.token }} # TODO: admin PAT with scopes: public_repo, workflows, org:write + #admin_token: ${{ github.token }} # TODO: admin PAT with scopes: public_repo, workflows, org:write slack_webhook_url: "" # TODO with: From 7d7243b9df1db2d3154be0cf57401a6bad8a1676 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 17:03:42 -0500 Subject: [PATCH 50/78] undo debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 38de562f..141242d2 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -136,7 +136,7 @@ jobs: uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha # TODO: setup protected branch with required pr review and checks secrets: - #admin_token: ${{ github.token }} # TODO: admin PAT with scopes: public_repo, workflows, org:write + admin_token: ${{ github.token }} # TODO: admin PAT with scopes: public_repo, workflows, org:write slack_webhook_url: "" # TODO with: From dd863a77bd9827c14414b4a8e3eda5418f182343 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 17:23:54 -0500 Subject: [PATCH 51/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 141242d2..92c1b279 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -41,6 +41,7 @@ jobs: shell: bash run: | gh api -X POST -f content=eyes /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions + gh repo view st2sandbox/pack-reviewboard ready_to_merge_check: needs: [permissions_check] From ad67a0756ca3725e00e0e161c2eda5e0d265c989 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:02:34 -0500 Subject: [PATCH 52/78] un-debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 92c1b279..141242d2 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -41,7 +41,6 @@ jobs: shell: bash run: | gh api -X POST -f content=eyes /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions - gh repo view st2sandbox/pack-reviewboard ready_to_merge_check: needs: [permissions_check] From fa254e6a3e4126b48f0d76f9cf5e512b1c902cbe Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:14:22 -0500 Subject: [PATCH 53/78] job names --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 141242d2..6782a060 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -22,6 +22,7 @@ env: jobs: permissions_check: + name: Check Comment Author Permissions # "!bootstrap pack" comment on pull requests if: >- github.event.issue.pull_request @@ -43,6 +44,7 @@ jobs: gh api -X POST -f content=eyes /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions ready_to_merge_check: + name: Check for Merge Readiness needs: [permissions_check] runs-on: ubuntu-latest steps: @@ -108,6 +110,7 @@ jobs: gh pr comment '${{ github.event.issue.html_url }}' --body "${COMMENT}" extract_pack_details: + name: New Pack / Extract Details needs: [permissions_check, ready_to_merge_check] runs-on: ubuntu-latest steps: @@ -155,6 +158,7 @@ jobs: # https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-923614663 # https://github.com/StackStorm-Exchange/exchange-incubator/issues/7#issuecomment-281247786 create_pack_pr: + name: New Pack / Create First PR needs: [extract_pack_details, bootstrap_pack_repo] runs-on: ubuntu-latest steps: From 098b711e30d203cc6629e7e090878ffb522787f5 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:21:52 -0500 Subject: [PATCH 54/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 6782a060..7aaf0162 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -138,12 +138,17 @@ jobs: # TODO: switch from @gha to @master uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha # TODO: setup protected branch with required pr review and checks + + # use inherit instead of dict to pass all secrets to the subworkflow + #secrets: inherit secrets: - admin_token: ${{ github.token }} # TODO: admin PAT with scopes: public_repo, workflows, org:write + # TODO: admin PAT with scopes: public_repo, workflows, org:write + admin_token: ${{ github.token }} slack_webhook_url: "" # TODO with: + test_thing: ${{ github.token }} - # TODO: validate that this || works as expected + # TODO: validate that this || works if pack_ref is empty pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} pack_description: ${{ needs.extract_pack_details.outputs.pack_description }} From 8490bee1e58b8dd3cc2dc959218187b6b56f387b Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:24:24 -0500 Subject: [PATCH 55/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 7aaf0162..3d1f2d5b 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -146,7 +146,7 @@ jobs: admin_token: ${{ github.token }} slack_webhook_url: "" # TODO with: - test_thing: ${{ github.token }} + test_thing: test # TODO: validate that this || works if pack_ref is empty pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} From e5d640b888d9051130aa318ff1d5625ab2fdfec0 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:33:00 -0500 Subject: [PATCH 56/78] try using workflow in same org --- .github/workflows/bootstrap_pack_from_pr.yaml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 3d1f2d5b..f22c2568 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -117,7 +117,8 @@ jobs: - name: Extract Pack Details id: pack-details # TODO: switch from @gha to @master - uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta@gha + #uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta@gha + uses: st2sandbox/exchange-ci/.github/actions/extract-pack-meta@gha with: pack-directory: incubator repository: ${{ github.repository }} @@ -136,7 +137,8 @@ jobs: needs: [extract_pack_details] name: New Pack # / Bootstrap Repo # TODO: switch from @gha to @master - uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha + #uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha + uses: st2sandbox/exchange-ci/.github/workflows/pack-bootstrap_repo.yaml@gha # TODO: setup protected branch with required pr review and checks # use inherit instead of dict to pass all secrets to the subworkflow From ddad4ca9c1d4f85db10fff4f1221b3671f9a77a5 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:36:19 -0500 Subject: [PATCH 57/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index f22c2568..e933166c 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -148,7 +148,7 @@ jobs: admin_token: ${{ github.token }} slack_webhook_url: "" # TODO with: - test_thing: test + test_thing: ${{ github.token }} # TODO: validate that this || works if pack_ref is empty pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} From ae9857c6612f0c6e02e5590520b78eeffbbc2261 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:40:52 -0500 Subject: [PATCH 58/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index e933166c..232caab0 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -148,7 +148,7 @@ jobs: admin_token: ${{ github.token }} slack_webhook_url: "" # TODO with: - test_thing: ${{ github.token }} + test_thing: ${{ secrets.GITHUB_TOKEN }} # TODO: validate that this || works if pack_ref is empty pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} From 6e45083e03af8bdc19dcfdae511a230d7e9fc431 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:45:18 -0500 Subject: [PATCH 59/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 232caab0..ccf5fc69 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -144,11 +144,14 @@ jobs: # use inherit instead of dict to pass all secrets to the subworkflow #secrets: inherit secrets: + # context: github, needs, secrets # TODO: admin PAT with scopes: public_repo, workflows, org:write - admin_token: ${{ github.token }} + #admin_token: ${{ github.token }} + admin_token: ${{ secrets.GITHUB_TOKEN }} slack_webhook_url: "" # TODO with: - test_thing: ${{ secrets.GITHUB_TOKEN }} + # context: github, needs + #test_thing: ${{ secrets.GITHUB_TOKEN }} # TODO: validate that this || works if pack_ref is empty pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} From ccc953cda8d2c1bc639c15744ac635001d15fddb Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 19:48:36 -0500 Subject: [PATCH 60/78] clarify --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index ccf5fc69..2d1fca42 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -145,13 +145,13 @@ jobs: #secrets: inherit secrets: # context: github, needs, secrets + # (github.token is not available, but secrets.GITHUB_TOKEN is) + # TODO: admin PAT with scopes: public_repo, workflows, org:write - #admin_token: ${{ github.token }} admin_token: ${{ secrets.GITHUB_TOKEN }} slack_webhook_url: "" # TODO with: # context: github, needs - #test_thing: ${{ secrets.GITHUB_TOKEN }} # TODO: validate that this || works if pack_ref is empty pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} From 0bd76b54a38de8402aaeaf5f3c1e46071e091a66 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 22:12:52 -0500 Subject: [PATCH 61/78] test token without workflow scope --- .github/workflows/bootstrap_pack_from_pr.yaml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 2d1fca42..304aa754 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -15,8 +15,6 @@ on: permissions: pull-requests: write # comments, reactions contents: read - #checks: read - #statuses: read env: GH_TOKEN: ${{ github.token }} @@ -147,8 +145,9 @@ jobs: # context: github, needs, secrets # (github.token is not available, but secrets.GITHUB_TOKEN is) - # TODO: admin PAT with scopes: public_repo, workflows, org:write - admin_token: ${{ secrets.GITHUB_TOKEN }} + # TODO: admin PAT with scopes: public_repo, workflows, write:org + #admin_token: ${{ secrets.GITHUB_TOKEN }} + admin_token: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # scopes: public_repo, write:org slack_webhook_url: "" # TODO with: # context: github, needs From 5eac7c012c13928c771f4104b38936b92df1da1b Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 22:20:43 -0500 Subject: [PATCH 62/78] clarify scopes --- .github/workflows/bootstrap_pack_from_pr.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 304aa754..d8eac626 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -9,7 +9,7 @@ on: types: created # need secrets for bootstrap_pack_repo job: -# admin_token: admin bot PAT w/ scopes public_repo, workflow, write:org +# admin_token: admin bot PAT w/ scopes public_repo, admin:org # slack_webhook_url permissions: @@ -145,9 +145,9 @@ jobs: # context: github, needs, secrets # (github.token is not available, but secrets.GITHUB_TOKEN is) - # TODO: admin PAT with scopes: public_repo, workflows, write:org + # TODO: admin PAT with scopes: public_repo, admin:org #admin_token: ${{ secrets.GITHUB_TOKEN }} - admin_token: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # scopes: public_repo, write:org + admin_token: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # scopes: public_repo, admin:org slack_webhook_url: "" # TODO with: # context: github, needs From 0b35ca43825b64441e30421a81f420f484005062 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 22:36:19 -0500 Subject: [PATCH 63/78] public_repo scope is not enough. we need repo scope repo scope is required to set protected branch settings. --- .github/workflows/bootstrap_pack_from_pr.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index d8eac626..9625d19f 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -9,7 +9,7 @@ on: types: created # need secrets for bootstrap_pack_repo job: -# admin_token: admin bot PAT w/ scopes public_repo, admin:org +# admin_token: admin bot PAT w/ scopes repo, admin:org # slack_webhook_url permissions: @@ -145,9 +145,8 @@ jobs: # context: github, needs, secrets # (github.token is not available, but secrets.GITHUB_TOKEN is) - # TODO: admin PAT with scopes: public_repo, admin:org #admin_token: ${{ secrets.GITHUB_TOKEN }} - admin_token: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # scopes: public_repo, admin:org + admin_token: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # scopes: admin:org, repo slack_webhook_url: "" # TODO with: # context: github, needs From 70be438c7724009ec0689c75f47388bcabb34ae8 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Wed, 18 May 2022 23:12:23 -0500 Subject: [PATCH 64/78] clarify secrets reqs --- .github/workflows/bootstrap_pack_from_pr.yaml | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 9625d19f..b7ddb5e8 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -8,9 +8,9 @@ on: issue_comment: types: created -# need secrets for bootstrap_pack_repo job: -# admin_token: admin bot PAT w/ scopes repo, admin:org -# slack_webhook_url +# make sure these secrets are defined: +# NEW_PACK_REPOS_TOKEN: bot PAT w/ scopes: repo, admin:org +# PACK_SLACK_WEBHOOK_URL permissions: pull-requests: write # comments, reactions @@ -139,17 +139,12 @@ jobs: uses: st2sandbox/exchange-ci/.github/workflows/pack-bootstrap_repo.yaml@gha # TODO: setup protected branch with required pr review and checks - # use inherit instead of dict to pass all secrets to the subworkflow - #secrets: inherit - secrets: - # context: github, needs, secrets - # (github.token is not available, but secrets.GITHUB_TOKEN is) + secrets: # available contexts: github, needs, secrets - #admin_token: ${{ secrets.GITHUB_TOKEN }} admin_token: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # scopes: admin:org, repo - slack_webhook_url: "" # TODO - with: - # context: github, needs + slack_webhook_url: ${{ secrets.PACK_SLACK_WEBHOOK_URL }} + + with: # available contexts: github, needs # TODO: validate that this || works if pack_ref is empty pack_name: ${{ needs.extract_pack_details.outputs.pack_ref || needs.extract_pack_details.outputs.pack_name }} From 0f93f3106f1ba621fb0592db34f979e97563f077 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:09:29 -0500 Subject: [PATCH 65/78] typo --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index b7ddb5e8..265eb643 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -213,7 +213,7 @@ jobs: PACK_DIR=$( realpath --relative-to="${PWD}" '${{ needs.extract_pack_details.outputs.pack_path }}' ) - git-filter-repo --sudirectory-filter "${PACK_DIR}" --force + git-filter-repo --subdirectory-filter "${PACK_DIR}" --force - name: Add incubator as git remote if: needs.extract_pack_details.outputs.in_submodule == 'false' From 5125b9d2f6881eff22db6bd9d25ffcf60958a9cd Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:25:19 -0500 Subject: [PATCH 66/78] configure git user/email --- .github/workflows/bootstrap_pack_from_pr.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 265eb643..1f77eb88 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -167,9 +167,15 @@ jobs: steps: - name: Setup environment shell: bash + env: + # Should we make this configurable somehow? (repository secrets, ...) + BOT_USER: stackstorm-neptr + BOT_EMAIL: info@stackstorm.com run: | mkdir -p ${HOME}/.local/bin echo "$HOME/.local/bin" >> $GITHUB_PATH + git config --global user.name "${BOT_USER}" + git config --global user.email "${BOT_EMAIL}" - name: Install git-filter-branch if: needs.extract_pack_details.outputs.in_submodule == 'false' From 7d99abb7c4eea9e2b878892b59c83ed60b12b261 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:31:02 -0500 Subject: [PATCH 67/78] cleanup PR creation --- .github/workflows/bootstrap_pack_from_pr.yaml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 1f77eb88..84262bd5 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -257,15 +257,16 @@ jobs: - name: Create initial content PR on pack repo working-directory: pack shell: bash + env: + PR_TITLE: 'Transfer ${{ needs.extract_pack_details.outputs.pack_name }} pack from Incubator' + PR_BODY: | + Pack: ${{ needs.extract_pack_details.outputs.pack_name }} + Description: ${{ needs.extract_pack_details.outputs.pack_description }} + Incubator PR: ${{ github.event.issue.html_url }} # gh handles pushing using the token before creating the PR run: | - git config set remote.origin.gh-resolved base - gh pr create \ - --title 'Transfer ${{ needs.extract_pack_details.outputs.pack_name }} pack from Incubator' - --body '\ - Pack: ${{ needs.extract_pack_details.outputs.pack_name }}\n\ - Description: ${{ needs.extract_pack_details.outputs.pack_description }}\n\ - Incubator PR: ${{ github.event.issue.html_url }}' + git config remote.origin.gh-resolved base + gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" - name: Mark running with hooray reaction and label shell: bash From 3754d6f607a93f8d55396cdfe8c4d6821b022e7c Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:34:57 -0500 Subject: [PATCH 68/78] debug --- .github/workflows/bootstrap_pack_from_pr.yaml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 84262bd5..81aa36bb 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -266,6 +266,9 @@ jobs: # gh handles pushing using the token before creating the PR run: | git config remote.origin.gh-resolved base + git status + git branch + cat .git/config gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" - name: Mark running with hooray reaction and label From 5b7dcf89d8d8368a5cb9e9e02f522bc50132c40d Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:42:56 -0500 Subject: [PATCH 69/78] configure branch upstream --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 81aa36bb..bd367623 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -242,6 +242,7 @@ jobs: shell: bash run: | git checkout -b transfer + git branch --set-upstream-to=origin - name: Pull source history into pack repo working-directory: pack @@ -266,9 +267,6 @@ jobs: # gh handles pushing using the token before creating the PR run: | git config remote.origin.gh-resolved base - git status - git branch - cat .git/config gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" - name: Mark running with hooray reaction and label From f476c289813ba2e0117f08653d874e64ebdd6e6c Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:47:55 -0500 Subject: [PATCH 70/78] transfer branch upstream --- .github/workflows/bootstrap_pack_from_pr.yaml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index bd367623..4d11e603 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -242,7 +242,6 @@ jobs: shell: bash run: | git checkout -b transfer - git branch --set-upstream-to=origin - name: Pull source history into pack repo working-directory: pack @@ -267,7 +266,7 @@ jobs: # gh handles pushing using the token before creating the PR run: | git config remote.origin.gh-resolved base - gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" + gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" --head transfer - name: Mark running with hooray reaction and label shell: bash From 3399183ceb50b5ca151453a5bc2afc9171a1585e Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:52:11 -0500 Subject: [PATCH 71/78] admin token for PR create --- .github/workflows/bootstrap_pack_from_pr.yaml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 4d11e603..912255f2 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -141,7 +141,7 @@ jobs: secrets: # available contexts: github, needs, secrets - admin_token: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # scopes: admin:org, repo + admin_token: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # min scopes: admin:org, repo slack_webhook_url: ${{ secrets.PACK_SLACK_WEBHOOK_URL }} with: # available contexts: github, needs @@ -258,6 +258,7 @@ jobs: working-directory: pack shell: bash env: + GH_TOKEN: ${{ secrets.NEW_PACK_REPOS_TOKEN }} # min scopes: public_repo (included in repo) PR_TITLE: 'Transfer ${{ needs.extract_pack_details.outputs.pack_name }} pack from Incubator' PR_BODY: | Pack: ${{ needs.extract_pack_details.outputs.pack_name }} From 04a40242c9c583dc185c13c89994c6afc59b4eee Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:54:31 -0500 Subject: [PATCH 72/78] transfer branch --- .github/workflows/bootstrap_pack_from_pr.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 912255f2..250c16ab 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -267,7 +267,7 @@ jobs: # gh handles pushing using the token before creating the PR run: | git config remote.origin.gh-resolved base - gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" --head transfer + gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" --head transfer:transfer - name: Mark running with hooray reaction and label shell: bash From 3acb427ec93bfb1eaaac154541cecd3863e7aae9 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 00:59:16 -0500 Subject: [PATCH 73/78] try using git push --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 250c16ab..4ba4eb8f 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -264,10 +264,10 @@ jobs: Pack: ${{ needs.extract_pack_details.outputs.pack_name }} Description: ${{ needs.extract_pack_details.outputs.pack_description }} Incubator PR: ${{ github.event.issue.html_url }} - # gh handles pushing using the token before creating the PR run: | git config remote.origin.gh-resolved base - gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" --head transfer:transfer + git push -u origin transfer + gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" - name: Mark running with hooray reaction and label shell: bash From ee9740ea18f24f2ae43391e5a0e3ce83a76eeb41 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 01:05:50 -0500 Subject: [PATCH 74/78] config git push --- .github/workflows/bootstrap_pack_from_pr.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 4ba4eb8f..0dc7b644 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -266,6 +266,7 @@ jobs: Incubator PR: ${{ github.event.issue.html_url }} run: | git config remote.origin.gh-resolved base + git config remote.origin.pushurl "https://${GH_TOKEN}@github.com/${{ needs.bootstrap_pack_repo.outputs.pack_repo }}.git" git push -u origin transfer gh pr create --title "${PR_TITLE}" --body "${PR_BODY}" From cf22523de181165fb63871d240b6ba70d7ab5100 Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 01:24:57 -0500 Subject: [PATCH 75/78] cleanup messages --- .github/workflows/bootstrap_pack_from_pr.yaml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 0dc7b644..f46bbc9f 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -99,11 +99,14 @@ jobs: env: COMMENT: | :rocket: Hold onto your hats! Now bootstrapping a new pack repo... + Bootstrapping will: (1) extract details about the new pack; (2) create the pack repo and repo metadata; (3) copy this PR into the `transfer` branch in the new repo; (4) use `transfer` branch for the pack's first PR. + + Details: ${{ github.server_url }}/${{ github.repository }}/runs/${{ github.run_id }} run: | gh pr comment '${{ github.event.issue.html_url }}' --body "${COMMENT}" @@ -273,25 +276,22 @@ jobs: - name: Mark running with hooray reaction and label shell: bash run: | + gh api -X DELETE /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels/bootstrap:in-progress gh api -X POST -f content=hooray /repos/${{ github.repository }}/issues/comments/${{ github.event.comment.id }}/reactions jq -n '{"labels": ["bootstrap:complete"]}' | gh api -X POST /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels --input - - gh api -X DELETE /repos/${{ github.repository }}/issues/${{ github.event.issue.number }}/labels/bootstrap:in-progress - name: Publish status in incubator PR comment shell: bash env: COMMENT: | - :tada: Hoooray, the initial content PR (\ - https://github.com/${{ needs.bootstrap_pack_repo.outputs.pack_repo }}/pull/1\ - ) is ready for review! + :tada: Hoooray! Here is the pack's first PR: https://github.com/${{ needs.bootstrap_pack_repo.outputs.pack_repo }}/pull/1 + Please do the following: (1) make sure everything looks correct in the PR; (2) merge it! (3) make sure a TSC Senior Maintainer has setup group and user access; - (4) wait for the next exchange index update (monitor updates\ - [here](https://github.com/StackStorm-Exchange/index/actions)\ - ) - (5) once the index has updated, check out\ - https://exchange.stackstorm.org/#${{ needs.extract_pack_details.outputs.pack_name }}' + (4) wait for the next exchange index update (monitor updates [here](https://github.com/StackStorm-Exchange/index/actions)) + (5) once the index has updated, check out: + ${{ needs.bootstrap_pack_repo.outputs.homepage }} run: | gh pr comment '${{ github.event.issue.html_url }}' --body "${COMMENT}" From 325dd91bc196ba9578f1ae5a17272548057b770e Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 01:26:04 -0500 Subject: [PATCH 76/78] revert st2sandbox --- .github/workflows/bootstrap_pack_from_pr.yaml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index f46bbc9f..35b503cc 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -118,8 +118,7 @@ jobs: - name: Extract Pack Details id: pack-details # TODO: switch from @gha to @master - #uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta@gha - uses: st2sandbox/exchange-ci/.github/actions/extract-pack-meta@gha + uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta@gha with: pack-directory: incubator repository: ${{ github.repository }} @@ -138,8 +137,7 @@ jobs: needs: [extract_pack_details] name: New Pack # / Bootstrap Repo # TODO: switch from @gha to @master - #uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha - uses: st2sandbox/exchange-ci/.github/workflows/pack-bootstrap_repo.yaml@gha + uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha # TODO: setup protected branch with required pr review and checks secrets: # available contexts: github, needs, secrets @@ -155,8 +153,8 @@ jobs: # we are using defaults for these. #homepage: "https://exchange.stackstorm.com/#${PACK_NAME}" - pack_org: st2sandbox - pack_repo_prefix: pack + #pack_org: StackStorm-Exchange + #pack_repo_prefix: stackstorm #pack_repo_template: StackStorm-Exchange/ci-pack-template #tsc_team: TSC From fe9a757ae7b67397f8aa22934e788b5c9cd4e4eb Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 01:34:01 -0500 Subject: [PATCH 77/78] switch from @gha to @master and cleanup TODO comments --- .github/workflows/bootstrap_pack_from_pr.yaml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 35b503cc..6ed262d5 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -57,8 +57,7 @@ jobs: .state == "APPROVED"] | (.|all) and (.|length>0)' ) && echo "APPROVED=${APPROVED}" -# TODO: uncomment -# && [[ "${APPROVED}" == "true" ]] + && [[ "${APPROVED}" == "true" ]] - name: Make sure CI workflow is passing for PR shell: bash @@ -117,8 +116,7 @@ jobs: steps: - name: Extract Pack Details id: pack-details - # TODO: switch from @gha to @master - uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta@gha + uses: StackStorm-Exchange/ci/.github/actions/extract-pack-meta@master with: pack-directory: incubator repository: ${{ github.repository }} @@ -136,9 +134,7 @@ jobs: bootstrap_pack_repo: needs: [extract_pack_details] name: New Pack # / Bootstrap Repo - # TODO: switch from @gha to @master - uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@gha - # TODO: setup protected branch with required pr review and checks + uses: StackStorm-Exchange/ci/.github/workflows/pack-bootstrap_repo.yaml@master secrets: # available contexts: github, needs, secrets From 134e15e91eda41b3d229eb37d6c6fd14a36e3ddd Mon Sep 17 00:00:00 2001 From: Jacob Floyd Date: Thu, 19 May 2022 16:54:59 -0500 Subject: [PATCH 78/78] cleanup comments --- .github/workflows/bootstrap_pack_from_pr.yaml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/bootstrap_pack_from_pr.yaml b/.github/workflows/bootstrap_pack_from_pr.yaml index 6ed262d5..a257eb60 100644 --- a/.github/workflows/bootstrap_pack_from_pr.yaml +++ b/.github/workflows/bootstrap_pack_from_pr.yaml @@ -1,10 +1,6 @@ name: Bootstrack Pack from PR on: -# pull_request_target: -# types: [labeled] -# pull_request_review: -# types: [submitted] issue_comment: types: created