Skip to content

Commit

Permalink
ci(root): Run CSpell only on community PRs (#5633)
Browse files Browse the repository at this point in the history
* Add team members check to GitHub workflow

Introduced a new step in the GitHub Actions workflow which checks if the PR creator is part of the team. If they aren't, a spell check is performed. This step makes sure that the member's work gets auto-approved without need for a spell check.

* Remove GitHub token login step in test workflow

Removed the step that logs into GitHub using a token in the test workflow. The change simplifies the workflow, as authentication is not necessary for the subsequent operations.

* Remove authentication step from test workflow

The authentication step using `gh auth login --with-token` has been removed from the Github Action's test workflow(.github/workflows/test.yml). This change simplifies the workflow process by relying solely on the GH_TOKEN environment variable for authentication.

* Update GitHub token and simplify team member check

The workflow file has been updated to use a different GitHub token and the check for team member list has been condensed, improving efficiency. A login step using the new token has also been added. Redundant steps checking for team members have been removed.

* Set environment to Production for spellcheck workflow

The spellcheck workflow in GitHub actions is now set to run in the Production environment. This update helps ensure the workflow executes in the correct context.

* Update test workflow environments

The testing workflows have been modified to improve code quality. Specifically, the 'Dependency review' and 'Spell check' tasks in the GitHub Actions workflow (test.yml), now run in the 'Linting' environment instead of 'Production'.

* Update GitHub token reference in test workflow

The GitHub token reference in .github/workflows/test.yml has been updated. The previous token, GITHUB_TOKEN, has been replaced with a new token named GH_TOKEN. This is a simple change that aligns the token name with our new naming conventions.

* Update environmental variable in GitHub workflow

The environmental variable name for storing the GitHub token in GitHub Actions workflow file (test.yml) has been changed from GH_TOKEN to GITHUB_TOKEN. Additionally, the explicit GitHub login command using the stored token has been removed.
  • Loading branch information
Cliftonz authored and SokratisVidros committed May 27, 2024
1 parent c255340 commit af2f79a
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
dependency-review:
name: Dependency review
runs-on: ubuntu-latest
environment: Linting
steps:
- name: 'Checkout Repository'
uses: actions/checkout@v3
Expand All @@ -20,9 +21,27 @@ jobs:
spellcheck:
name: Spell check
runs-on: ubuntu-latest
environment: Linting
steps:
- uses: actions/checkout@v3
- uses: streetsidesoftware/cspell-action@v5
- 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

get-affected:
name: Get Affected Packages
Expand Down

0 comments on commit af2f79a

Please sign in to comment.