From 498e20f5626c9483e08c710fd399abc0cdba52d5 Mon Sep 17 00:00:00 2001 From: Zac Clifton <43915749+Cliftonz@users.noreply.github.com> Date: Tue, 28 May 2024 11:44:08 +0200 Subject: [PATCH 1/2] Add LaunchDarkly flag finder workflow A new Github Actions workflow for finding LaunchDarkly feature flags was added to the codebase. Now we have better visibility regarding any feature flags that get introduced or removed with any PRs, helping maintain code quality. The spell check step has been temporarily disabled. --- .github/workflows/test.yml | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index f5ff9800bc5..d287deba2b1 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,25 +24,26 @@ jobs: environment: Linting steps: - uses: actions/checkout@v3 - - name: List team members ad check - id: check-user - env: - GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} - run: | - members=$(gh api --paginate "organizations/77433905/team/5565599/members" | jq -r '.[] | .login') - echo "Team members: $members" - if [[ $members == *"$PR_CREATOR"* ]]; then - echo "PR creator is a member of the team." - echo "SKIP_STEP=true" >> $GITHUB_ENV - else - echo "PR creator is not a team member." - echo "SKIP_STEP=false" >> $GITHUB_ENV - fi - - name: Run Spell Check - if: env.SKIP_STEP == 'false' uses: streetsidesoftware/cspell-action@v5 + find-flags: + runs-on: ubuntu-latest + name: Find LaunchDarkly feature flags in diff + environment: Linting + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Find flags + uses: launchdarkly/find-code-references-in-pull-request@v2 + id: find-flags + with: + project-key: default + environment-key: production + access-token: ${{ secrets.LD_ACCESS_TOKEN }} + repo-token: ${{ secrets.GITHUB_TOKEN }} + get-affected: name: Get Affected Packages runs-on: ubuntu-latest From a7985993cabb59be03bd45d3cae0670951f0b5fe Mon Sep 17 00:00:00 2001 From: Zac Clifton <43915749+Cliftonz@users.noreply.github.com> Date: Tue, 28 May 2024 11:51:36 +0200 Subject: [PATCH 2/2] Add team membership check to workflow The commit adds a new step to the GitHub Actions workflow that checks if the creator of a pull request (PR) is a member of the specified team. If the PR creator is a team member, the workflow step for running the spell checker is skipped. This check is done using the GitHub API and the 'jq' command-line tool. --- .github/workflows/test.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d287deba2b1..4ccdc898c70 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -24,7 +24,23 @@ jobs: environment: Linting steps: - uses: actions/checkout@v3 + - name: List team members ad check + id: check-user + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} + run: | + members=$(gh api --paginate "organizations/77433905/team/5565599/members" | jq -r '.[] | .login') + echo "Team members: $members" + if [[ $members == *"$PR_CREATOR"* ]]; then + echo "PR creator is a member of the team." + echo "SKIP_STEP=true" >> $GITHUB_ENV + else + echo "PR creator is not a team member." + echo "SKIP_STEP=false" >> $GITHUB_ENV + fi + - name: Run Spell Check + if: env.SKIP_STEP == 'false' uses: streetsidesoftware/cspell-action@v5 find-flags: