From c6d9645e480484a8fb5a746d934653750995375d Mon Sep 17 00:00:00 2001 From: Jack Green Date: Mon, 9 Dec 2024 11:26:06 +0000 Subject: [PATCH] Remove `test-membership` duplication (#930) The PR builder uses a local copy of an action which has [since been centralised](https://github.com/hazelcast/hazelcast-tpm/blob/main/membership/action.yaml). This was originally copied from the pattern in `hazelcast-nodejs-client` - but this has [since been migrated](https://github.com/hazelcast/hazelcast-nodejs-client/blob/master/.github/workflows/coverage_runner.yml#L16-L29). Updated to use centralise version - allowing a central place to make improvements. --- .github/actions/test-membership/action.yml | 33 ---------------------- .github/workflows/build-pr.yml | 13 ++------- 2 files changed, 2 insertions(+), 44 deletions(-) delete mode 100644 .github/actions/test-membership/action.yml diff --git a/.github/actions/test-membership/action.yml b/.github/actions/test-membership/action.yml deleted file mode 100644 index a271d3c2f8..0000000000 --- a/.github/actions/test-membership/action.yml +++ /dev/null @@ -1,33 +0,0 @@ -# -# Action: Test Membership -# -# Tests whether a member name is part of an organization. -# -# copied and adapted from https://github.com/hazelcast/hazelcast-tpm/blob/main/membership/action.yaml -# example usage in https://github.com/hazelcast/hazelcast-nodejs-client/blob/master/.github/workflows/coverage_runner.yml#L19 -# - -name: Test Membership -inputs: - organization-name: - required: true - member-name: - required: true - token: - required: true -outputs: - is-member: - description: "Whether the member name is a member of the organization" - value: ${{ steps.test-membership.outputs.is-member }} -runs: - using: "composite" - steps: - - id: test-membership - shell: bash - run: | - response=$(curl -v -H "Authorization: token ${{ inputs.token }}" --write-out '%{http_code}' --silent --output /dev/null "https://api.github.com/orgs/${{ inputs.organization-name }}/memberships/${{ inputs.member-name }}") - if [[ "$response" -ne 200 ]] ; then - echo "is-member=false" >> $GITHUB_OUTPUT - else - echo "is-member=true" >> $GITHUB_OUTPUT - fi \ No newline at end of file diff --git a/.github/workflows/build-pr.yml b/.github/workflows/build-pr.yml index e9c871cc80..779c6c6bc4 100644 --- a/.github/workflows/build-pr.yml +++ b/.github/workflows/build-pr.yml @@ -39,21 +39,12 @@ jobs: name: Test Hazelcast Membership runs-on: ubuntu-latest outputs: - is-hazelcast: ${{ steps.test-membership.outputs.is-member }} + is-hazelcast: ${{ steps.test-membership.outputs.check-result }} steps: - # checkout the hazelcast/hazelcast-csharp-client repository - # bare minimum - just to use actions - - name: Checkout code - uses: actions/checkout@v4 - with: - ref: ${{ inputs.ref }} - token: ${{ secrets.GITHUB_TOKEN }} - submodules: false - - name: Test id: test-membership - uses: ./.github/actions/test-membership + uses: hazelcast/hazelcast-tpm/membership@main with: organization-name: hazelcast member-name: ${{ github.event.pull_request.head.repo.owner.login }}