diff --git a/.github/workflows/run-samples.yml b/.github/workflows/run-samples.yml deleted file mode 100644 index 6524f69..0000000 --- a/.github/workflows/run-samples.yml +++ /dev/null @@ -1,87 +0,0 @@ -name: Run Samples -on: - # By design pull_request_target event run against the version of the workflow in the target branch. - # So you have to merge changes to this workflow to observe the effects. - pull_request_target: - branches: - - main - paths: - - scenarios/** - - .infra/deployments/**/*.bicep -jobs: - check-if-external: - runs-on: ubuntu-latest - outputs: - environment: ${{ steps.set-environment.outputs.result }} - steps: - - uses: actions/github-script@f28e40c7f34bde8b3046d885e986cb6290c5673b # v7.1.0 - id: set-environment - with: - script: | - const actionInitiator = context.payload.sender.login; - const org = "Azure-Samples"; - let isPublicMember = true; - - // Check if initiator is a public member of the org - try { - await github.rest.orgs.checkPublicMembershipForUser({ - org, - username: actionInitiator - }); - } catch (error) { - if (error.status != 404) { - throw new Error("Unknown error", {cause: error}); - } - - console.debug([ - `User is not a public member of the organization "${org}"`, - "", - `If you are a Microsoft employee, you can join the "${org}" org and set your org membership visibility to public: https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-membership-in-organizations/publicizing-or-hiding-organization-membership#changing-the-visibility-of-your-organization-membership` - ].join("\n")); - - isPublicMember = false; - } - - - const isPullRequestEvent = ["pull_request", "pull_request_target"].includes(context.eventName); - - if (!(isPublicMember && isPullRequestEvent)) { - return "external-contribution"; - } - return ""; - result-encoding: string - run-samples: - permissions: - contents: 'read' - id-token: 'write' - needs: check-if-external - runs-on: ubuntu-latest - # Require manual approval if initiator is not a public member of Azure-Samples - environment: ${{ needs.check-if-external.outputs.environment }} - steps: - - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - - uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4.4.0 - with: - ref: ${{ github.event.pull_request.head.sha || github.ref }} - - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - with: - python-version: "3.9" - - name: Install dev dependencies - run: | - pip install -r dev-requirements.txt - - uses: azure/login@7184910d9eb2b1c5e48f7073824a90609bb9b6d6 # v2.3.1 - with: - client-id: ${{ secrets.AZURE_CLIENT_ID }} - tenant-id: ${{ secrets.AZURE_TENANT_ID }} - subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} - - name: Deploy resources - run: | - principalId="$(az ad sp show --id ${{ secrets.AZURE_CLIENT_ID }} -o tsv --query id)" - az deployment sub create --location eastus \ - --template-file .infra/deployment/main.bicep \ - --parameters principalType=ServicePrincipal \ - --parameters principalId="$principalId" \ - -o json > deployment.json - - name: Run Changed Samples - run: - pytest --changed-samples-only-from ${{ github.event.pull_request.base.sha }} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 3a62283..d38168e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -128,21 +128,8 @@ Note that samples are organized by scenario, find the one best-suited for your s #### Resolve Failing Pull Request Checks - -> [!IMPORTANT] -> -> This repository requires approval from someone with write access for pull request checks -> to run against a PR, to avoid abuse of live resources. -> -> All of the PR checks can also be run from developers machine, which should prevent the approval -> processes from unnecessarily lengthening the feedback cycle. - -> [!NOTE] -> If you are a Microsoft employee, you can skip the approval process for PR checks by: -> -> * Joining the "[Azure-Samples](https://github.com/Azure-Samples)" organization -> * [Setting your org membership visibility to public](https://docs.github.com/en/account-and-profile/setting-up-and-managing-your-personal-account-on-github/managing-your-membership-in-organizations/publicizing-or-hiding-organization-membership#changing-the-visibility-of-your-organization-membership) -> +Pull request checks run pre-commit and check the size of the contribution. +Run affected samples locally using their setup instructions. ##### pre-commit @@ -193,4 +180,3 @@ The Code Samples browser content is updated twice a week, so it may take a few d [readme template]: ./.infra/templates/README-template.md [jupyter notebook template]: ./.infra/templates/template.ipynb -