From 7b926aa13e58275c1aed29539d38909495eddfe8 Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Tue, 31 Dec 2024 07:49:02 -0800 Subject: [PATCH 1/6] Updated workflows --- .../{ => archive}/pull-docs-admin.sh | 0 .../workflows/{ => archive}/pull-docs-api.sh | 0 .../pull-latest-docs.yml} | 0 .../{ => archive}/pull-talawa-mobile-docs.sh | 0 .../{ => archive}/push-schema-doc.yml | 0 .../authorized-changes-detection.yml | 59 -------- .github/workflows/documentation.yml | 94 ------------- .github/workflows/pull-request.yml | 129 ++++++++++++++++++ .github/workflows/push-deploy-website.yml | 39 ++++++ 9 files changed, 168 insertions(+), 153 deletions(-) rename .github/workflows/{ => archive}/pull-docs-admin.sh (100%) rename .github/workflows/{ => archive}/pull-docs-api.sh (100%) rename .github/workflows/{pull-latest-docs.yml.old => archive/pull-latest-docs.yml} (100%) rename .github/workflows/{ => archive}/pull-talawa-mobile-docs.sh (100%) rename .github/workflows/{ => archive}/push-schema-doc.yml (100%) delete mode 100644 .github/workflows/authorized-changes-detection.yml delete mode 100644 .github/workflows/documentation.yml create mode 100644 .github/workflows/pull-request.yml create mode 100644 .github/workflows/push-deploy-website.yml diff --git a/.github/workflows/pull-docs-admin.sh b/.github/workflows/archive/pull-docs-admin.sh similarity index 100% rename from .github/workflows/pull-docs-admin.sh rename to .github/workflows/archive/pull-docs-admin.sh diff --git a/.github/workflows/pull-docs-api.sh b/.github/workflows/archive/pull-docs-api.sh similarity index 100% rename from .github/workflows/pull-docs-api.sh rename to .github/workflows/archive/pull-docs-api.sh diff --git a/.github/workflows/pull-latest-docs.yml.old b/.github/workflows/archive/pull-latest-docs.yml similarity index 100% rename from .github/workflows/pull-latest-docs.yml.old rename to .github/workflows/archive/pull-latest-docs.yml diff --git a/.github/workflows/pull-talawa-mobile-docs.sh b/.github/workflows/archive/pull-talawa-mobile-docs.sh similarity index 100% rename from .github/workflows/pull-talawa-mobile-docs.sh rename to .github/workflows/archive/pull-talawa-mobile-docs.sh diff --git a/.github/workflows/push-schema-doc.yml b/.github/workflows/archive/push-schema-doc.yml similarity index 100% rename from .github/workflows/push-schema-doc.yml rename to .github/workflows/archive/push-schema-doc.yml diff --git a/.github/workflows/authorized-changes-detection.yml b/.github/workflows/authorized-changes-detection.yml deleted file mode 100644 index 89ad3decb2a..00000000000 --- a/.github/workflows/authorized-changes-detection.yml +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################## -############################################################################## -# -# NOTE! -# -# Please read the README.md file in this directory that defines what should -# be placed in this file -# -############################################################################## -############################################################################## - -name: Checking workflow files -on: - pull_request: - branches: - - '**' - -jobs: - Check-Sensitive-Files: - if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} - name: Checks if sensitive files have been changed without authorization - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 - - - name: Get Changed Unauthorized files - id: changed-unauth-files - uses: tj-actions/changed-files@v45 - with: - files: | - .github/** - CNAME - static/CNAME - package.json - sidebar*.js - docusaurus.config.js - babel.config.js - CODEOWNERS - LICENSE - ./*md - package-lock.json - tsconfig.json - yarn.lock - static/.nojekyll - tsconfig.json - .gitignore - babel.config.js - - - name: List all changed unauthorized files - if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' - env: - CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} - run: | - for file in ${CHANGED_UNAUTH_FILES}; do - echo "$file is unauthorized to change/delete" - done - echo "To override this, apply the 'ignore-sensitive-files-pr' label" - exit 1 diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml deleted file mode 100644 index ece1eedd25c..00000000000 --- a/.github/workflows/documentation.yml +++ /dev/null @@ -1,94 +0,0 @@ -name: Deploy to GitHub Pages - -on: - pull_request: - branches: - - master - - develop - push: - branches: - - master - - develop - -jobs: - test-deploy: - if: github.event_name != 'push' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: yarn - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Test building the website - run: yarn build - -# checks: -# if: github.event_name != 'push' -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - uses: actions/setup-node@v3 -# with: -# node-version: "16.x" -# - name: Test Build -# run: | -# if [ -e yarn.lock ]; then -# yarn install --frozen-lockfile -# elif [ -e package-lock.json ]; then -# npm ci -# else -# npm i -# fi -# npm run build - - deploy: - if: github.event_name != 'pull_request' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: yarn - - uses: webfactory/ssh-agent@v0.5.0 - with: - ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }} - - name: Deploy to GitHub Pages - env: - USE_SSH: true - GIT_USER: git - run: | - git config --global user.email "actions@github.com" - git config --global user.name "gh-actions" - yarn install --frozen-lockfile - yarn deploy - -# gh-release: -# if: github.event_name != 'pull_request' -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v3 -# - uses: actions/setup-node@v3 -# with: -# node-version: "16.x" -# - uses: webfactory/ssh-agent@v0.5.0 -# with: -# ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }} -# - name: Release to GitHub Pages -# env: -# USE_SSH: true -# GIT_USER: git -# run: | -# git config --global user.email "actions@github.com" -# git config --global user.name "gh-actions" -# if [ -e yarn.lock ]; then -# yarn install --frozen-lockfile -# elif [ -e package-lock.json ]; then -# npm ci -# else -# npm i -# fi -# npm run deploy diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml new file mode 100644 index 00000000000..6354a484761 --- /dev/null +++ b/.github/workflows/pull-request.yml @@ -0,0 +1,129 @@ +############################################################################## +############################################################################## +# +# NOTE! +# +# Please read the README.md file in this directory that defines what should +# be placed in this file +# +############################################################################## +############################################################################## + +name: Checking workflow files +on: + pull_request: + branches: + - '**' + +jobs: + Code-Quality-Checks: + name: Performs linting, formatting, type-checking, checking for different source and target branch + runs-on: ubuntu-latest + steps: + - name: Check if the source and target branches are different + if: ${{ github.event.pull_request.base.ref == github.event.pull_request.head.ref }} + run: | + echo "Source Branch ${{ github.event.pull_request.head.ref }}" + echo "Target Branch ${{ github.event.pull_request.base.ref }}" + echo "Error: Source and Target Branches are the same. Please ensure they are different." + exit 1 + + Check-Sensitive-Files: + if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} + name: Checks if sensitive files have been changed without authorization + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get Changed Unauthorized files + id: changed-unauth-files + uses: tj-actions/changed-files@v45 + with: + files: | + .github/** + CNAME + static/CNAME + package.json + sidebar*.js + docusaurus.config.js + babel.config.js + CODEOWNERS + LICENSE + ./*md + package-lock.json + tsconfig.json + yarn.lock + static/.nojekyll + tsconfig.json + .gitignore + babel.config.js + + - name: List all changed unauthorized files + if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' + env: + CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} + run: | + for file in ${CHANGED_UNAUTH_FILES}; do + echo "$file is unauthorized to change/delete" + done + echo "To override this, apply the 'ignore-sensitive-files-pr' label" + exit 1 + + Count-Changed-Files: + if: ${{ github.actor != 'dependabot[bot]' }} + name: Checks if number of files changed is acceptable + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 + + - name: Echo number of changed files + env: + CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} + run: | + echo "Number of files changed: $CHANGED_FILES_COUNT" + + - name: Check if the number of changed files is less than 100 + if: steps.changed-files.outputs.all_changed_files_count > 100 + env: + CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} + run: | + echo "Error: Too many files (greater than 100) changed in the pull request." + echo "Possible issues:" + echo "- Contributor may be merging into an incorrect branch." + echo "- Source branch may be incorrect please use develop as source branch." + exit 1 + + Test-Docusaurus-Deployment: + name: Test Deployment to https://docs.talawa.io + runs-on: ubuntu-latest + needs: [Check-Sensitive-Files] + # Run only if the develop branch and not dependabot + if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} + steps: + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Test building the website + run: yarn build + + Check-Target-Branch: + if: ${{ github.actor != 'dependabot[bot]' }} + name: Check Target Branch + runs-on: ubuntu-latest + steps: + - name: Check if the target branch is develop + if: github.event.pull_request.base.ref != 'develop' + run: | + echo "Error: Pull request target branch must be 'develop'. Please refer PR_GUIDELINES.md" + exit 1 diff --git a/.github/workflows/push-deploy-website.yml b/.github/workflows/push-deploy-website.yml new file mode 100644 index 00000000000..ad296368434 --- /dev/null +++ b/.github/workflows/push-deploy-website.yml @@ -0,0 +1,39 @@ +name: Deploy to GitHub Pages + +on: + push: + branches: + - 'develop' + +jobs: + Deploy-Docusaurus: + name: Deploy https://docs.talawa.io website + runs-on: ubuntu-latest + if: ${{ github.actor != 'dependabot[bot]' }} + environment: + # This "name" has to be the repos' branch that contains + # the current active website. There must be an entry for + # the same branch in the PalisadoesFoundation's + # "Code and automation > Environments > github-pages" + # menu. The branch "name" must match the branch in the + # "on.push.branches" section at the top of this file + name: develop + url: https://docs.talawa.io + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + - uses: webfactory/ssh-agent@v0.9.0 + with: + ssh-private-key: ${{ secrets.GH_PAGES_DEPLOY }} + - name: Deploy to GitHub Pages + env: + USE_SSH: true + GIT_USER: git + run: | + git config --global user.email "actions@github.com" + git config --global user.name "gh-actions" + yarn install --frozen-lockfile + yarn deploy From ac63cd421c92f7015eb84e9080655e482ee4e811 Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Tue, 31 Dec 2024 07:56:16 -0800 Subject: [PATCH 2/6] Fixed dependency --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 6354a484761..f02ca35dff7 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -102,7 +102,7 @@ jobs: Test-Docusaurus-Deployment: name: Test Deployment to https://docs.talawa.io runs-on: ubuntu-latest - needs: [Check-Sensitive-Files] + needs: [Code-Quality-Checks] # Run only if the develop branch and not dependabot if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} steps: From dcf43b1912f918f66bade93da2af8ea7666aba16 Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Tue, 31 Dec 2024 07:57:18 -0800 Subject: [PATCH 3/6] Comments --- .github/workflows/pull-request.yml | 152 ++++++++++++++--------------- 1 file changed, 76 insertions(+), 76 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index f02ca35dff7..c759e565081 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -16,93 +16,93 @@ on: - '**' jobs: - Code-Quality-Checks: - name: Performs linting, formatting, type-checking, checking for different source and target branch - runs-on: ubuntu-latest - steps: - - name: Check if the source and target branches are different - if: ${{ github.event.pull_request.base.ref == github.event.pull_request.head.ref }} - run: | - echo "Source Branch ${{ github.event.pull_request.head.ref }}" - echo "Target Branch ${{ github.event.pull_request.base.ref }}" - echo "Error: Source and Target Branches are the same. Please ensure they are different." - exit 1 + # Code-Quality-Checks: + # name: Performs linting, formatting, type-checking, checking for different source and target branch + # runs-on: ubuntu-latest + # steps: + # - name: Check if the source and target branches are different + # if: ${{ github.event.pull_request.base.ref == github.event.pull_request.head.ref }} + # run: | + # echo "Source Branch ${{ github.event.pull_request.head.ref }}" + # echo "Target Branch ${{ github.event.pull_request.base.ref }}" + # echo "Error: Source and Target Branches are the same. Please ensure they are different." + # exit 1 - Check-Sensitive-Files: - if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} - name: Checks if sensitive files have been changed without authorization - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 + # Check-Sensitive-Files: + # if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} + # name: Checks if sensitive files have been changed without authorization + # runs-on: ubuntu-latest + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 - - name: Get Changed Unauthorized files - id: changed-unauth-files - uses: tj-actions/changed-files@v45 - with: - files: | - .github/** - CNAME - static/CNAME - package.json - sidebar*.js - docusaurus.config.js - babel.config.js - CODEOWNERS - LICENSE - ./*md - package-lock.json - tsconfig.json - yarn.lock - static/.nojekyll - tsconfig.json - .gitignore - babel.config.js + # - name: Get Changed Unauthorized files + # id: changed-unauth-files + # uses: tj-actions/changed-files@v45 + # with: + # files: | + # .github/** + # CNAME + # static/CNAME + # package.json + # sidebar*.js + # docusaurus.config.js + # babel.config.js + # CODEOWNERS + # LICENSE + # ./*md + # package-lock.json + # tsconfig.json + # yarn.lock + # static/.nojekyll + # tsconfig.json + # .gitignore + # babel.config.js - - name: List all changed unauthorized files - if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' - env: - CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} - run: | - for file in ${CHANGED_UNAUTH_FILES}; do - echo "$file is unauthorized to change/delete" - done - echo "To override this, apply the 'ignore-sensitive-files-pr' label" - exit 1 + # - name: List all changed unauthorized files + # if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' + # env: + # CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} + # run: | + # for file in ${CHANGED_UNAUTH_FILES}; do + # echo "$file is unauthorized to change/delete" + # done + # echo "To override this, apply the 'ignore-sensitive-files-pr' label" + # exit 1 - Count-Changed-Files: - if: ${{ github.actor != 'dependabot[bot]' }} - name: Checks if number of files changed is acceptable - runs-on: ubuntu-latest - steps: - - name: Checkout code - uses: actions/checkout@v4 + # Count-Changed-Files: + # if: ${{ github.actor != 'dependabot[bot]' }} + # name: Checks if number of files changed is acceptable + # runs-on: ubuntu-latest + # steps: + # - name: Checkout code + # uses: actions/checkout@v4 - - name: Get changed files - id: changed-files - uses: tj-actions/changed-files@v45 + # - name: Get changed files + # id: changed-files + # uses: tj-actions/changed-files@v45 - - name: Echo number of changed files - env: - CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} - run: | - echo "Number of files changed: $CHANGED_FILES_COUNT" + # - name: Echo number of changed files + # env: + # CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} + # run: | + # echo "Number of files changed: $CHANGED_FILES_COUNT" - - name: Check if the number of changed files is less than 100 - if: steps.changed-files.outputs.all_changed_files_count > 100 - env: - CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} - run: | - echo "Error: Too many files (greater than 100) changed in the pull request." - echo "Possible issues:" - echo "- Contributor may be merging into an incorrect branch." - echo "- Source branch may be incorrect please use develop as source branch." - exit 1 + # - name: Check if the number of changed files is less than 100 + # if: steps.changed-files.outputs.all_changed_files_count > 100 + # env: + # CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} + # run: | + # echo "Error: Too many files (greater than 100) changed in the pull request." + # echo "Possible issues:" + # echo "- Contributor may be merging into an incorrect branch." + # echo "- Source branch may be incorrect please use develop as source branch." + # exit 1 Test-Docusaurus-Deployment: name: Test Deployment to https://docs.talawa.io runs-on: ubuntu-latest - needs: [Code-Quality-Checks] + # needs: [Code-Quality-Checks] # Run only if the develop branch and not dependabot if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} steps: From 98bf3b85aae47307e82808c89f3dd8d87799cdd6 Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Tue, 31 Dec 2024 07:58:25 -0800 Subject: [PATCH 4/6] Comments --- .github/workflows/pull-request.yml | 34 +++++++++++++++--------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index c759e565081..fc460f1a3c9 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -99,23 +99,23 @@ jobs: # echo "- Source branch may be incorrect please use develop as source branch." # exit 1 - Test-Docusaurus-Deployment: - name: Test Deployment to https://docs.talawa.io - runs-on: ubuntu-latest - # needs: [Code-Quality-Checks] - # Run only if the develop branch and not dependabot - if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} - steps: - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: 18 - cache: yarn - - name: Install dependencies - run: yarn install --frozen-lockfile - - name: Test building the website - run: yarn build + # Test-Docusaurus-Deployment: + # name: Test Deployment to https://docs.talawa.io + # runs-on: ubuntu-latest + # # needs: [Code-Quality-Checks] + # # Run only if the develop branch and not dependabot + # if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} + # steps: + # steps: + # - uses: actions/checkout@v3 + # - uses: actions/setup-node@v3 + # with: + # node-version: 18 + # cache: yarn + # - name: Install dependencies + # run: yarn install --frozen-lockfile + # - name: Test building the website + # run: yarn build Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} From bb71a9a197a69d8bd9ce3012902f98db1f36db14 Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Tue, 31 Dec 2024 07:59:15 -0800 Subject: [PATCH 5/6] Comments --- .github/workflows/pull-request.yml | 183 ++++++++++++++--------------- 1 file changed, 91 insertions(+), 92 deletions(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index fc460f1a3c9..09e68cbf709 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -16,106 +16,105 @@ on: - '**' jobs: - # Code-Quality-Checks: - # name: Performs linting, formatting, type-checking, checking for different source and target branch - # runs-on: ubuntu-latest - # steps: - # - name: Check if the source and target branches are different - # if: ${{ github.event.pull_request.base.ref == github.event.pull_request.head.ref }} - # run: | - # echo "Source Branch ${{ github.event.pull_request.head.ref }}" - # echo "Target Branch ${{ github.event.pull_request.base.ref }}" - # echo "Error: Source and Target Branches are the same. Please ensure they are different." - # exit 1 + Code-Quality-Checks: + name: Performs linting, formatting, type-checking, checking for different source and target branch + runs-on: ubuntu-latest + steps: + - name: Check if the source and target branches are different + if: ${{ github.event.pull_request.base.ref == github.event.pull_request.head.ref }} + run: | + echo "Source Branch ${{ github.event.pull_request.head.ref }}" + echo "Target Branch ${{ github.event.pull_request.base.ref }}" + echo "Error: Source and Target Branches are the same. Please ensure they are different." + exit 1 - # Check-Sensitive-Files: - # if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} - # name: Checks if sensitive files have been changed without authorization - # runs-on: ubuntu-latest - # steps: - # - name: Checkout code - # uses: actions/checkout@v4 + Check-Sensitive-Files: + if: ${{ github.actor != 'dependabot[bot]' && !contains(github.event.pull_request.labels.*.name, 'ignore-sensitive-files-pr') }} + name: Checks if sensitive files have been changed without authorization + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 - # - name: Get Changed Unauthorized files - # id: changed-unauth-files - # uses: tj-actions/changed-files@v45 - # with: - # files: | - # .github/** - # CNAME - # static/CNAME - # package.json - # sidebar*.js - # docusaurus.config.js - # babel.config.js - # CODEOWNERS - # LICENSE - # ./*md - # package-lock.json - # tsconfig.json - # yarn.lock - # static/.nojekyll - # tsconfig.json - # .gitignore - # babel.config.js + - name: Get Changed Unauthorized files + id: changed-unauth-files + uses: tj-actions/changed-files@v45 + with: + files: | + .github/** + CNAME + static/CNAME + package.json + sidebar*.js + docusaurus.config.js + babel.config.js + CODEOWNERS + LICENSE + ./*md + package-lock.json + tsconfig.json + yarn.lock + static/.nojekyll + tsconfig.json + .gitignore + babel.config.js - # - name: List all changed unauthorized files - # if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' - # env: - # CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} - # run: | - # for file in ${CHANGED_UNAUTH_FILES}; do - # echo "$file is unauthorized to change/delete" - # done - # echo "To override this, apply the 'ignore-sensitive-files-pr' label" - # exit 1 + - name: List all changed unauthorized files + if: steps.changed-unauth-files.outputs.any_changed == 'true' || steps.changed-unauth-files.outputs.any_deleted == 'true' + env: + CHANGED_UNAUTH_FILES: ${{ steps.changed-unauth-files.outputs.all_changed_files }} + run: | + for file in ${CHANGED_UNAUTH_FILES}; do + echo "$file is unauthorized to change/delete" + done + echo "To override this, apply the 'ignore-sensitive-files-pr' label" + exit 1 - # Count-Changed-Files: - # if: ${{ github.actor != 'dependabot[bot]' }} - # name: Checks if number of files changed is acceptable - # runs-on: ubuntu-latest - # steps: - # - name: Checkout code - # uses: actions/checkout@v4 + Count-Changed-Files: + if: ${{ github.actor != 'dependabot[bot]' }} + name: Checks if number of files changed is acceptable + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 - # - name: Get changed files - # id: changed-files - # uses: tj-actions/changed-files@v45 + - name: Get changed files + id: changed-files + uses: tj-actions/changed-files@v45 - # - name: Echo number of changed files - # env: - # CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} - # run: | - # echo "Number of files changed: $CHANGED_FILES_COUNT" + - name: Echo number of changed files + env: + CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} + run: | + echo "Number of files changed: $CHANGED_FILES_COUNT" - # - name: Check if the number of changed files is less than 100 - # if: steps.changed-files.outputs.all_changed_files_count > 100 - # env: - # CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} - # run: | - # echo "Error: Too many files (greater than 100) changed in the pull request." - # echo "Possible issues:" - # echo "- Contributor may be merging into an incorrect branch." - # echo "- Source branch may be incorrect please use develop as source branch." - # exit 1 + - name: Check if the number of changed files is less than 100 + if: steps.changed-files.outputs.all_changed_files_count > 100 + env: + CHANGED_FILES_COUNT: ${{ steps.changed-files.outputs.all_changed_files_count }} + run: | + echo "Error: Too many files (greater than 100) changed in the pull request." + echo "Possible issues:" + echo "- Contributor may be merging into an incorrect branch." + echo "- Source branch may be incorrect please use develop as source branch." + exit 1 - # Test-Docusaurus-Deployment: - # name: Test Deployment to https://docs.talawa.io - # runs-on: ubuntu-latest - # # needs: [Code-Quality-Checks] - # # Run only if the develop branch and not dependabot - # if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} - # steps: - # steps: - # - uses: actions/checkout@v3 - # - uses: actions/setup-node@v3 - # with: - # node-version: 18 - # cache: yarn - # - name: Install dependencies - # run: yarn install --frozen-lockfile - # - name: Test building the website - # run: yarn build + Test-Docusaurus-Deployment: + name: Test Deployment to https://docs.talawa.io + runs-on: ubuntu-latest + # needs: [Code-Quality-Checks] + # Run only if the develop branch and not dependabot + if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} + steps: + - uses: actions/checkout@v3 + - uses: actions/setup-node@v3 + with: + node-version: 18 + cache: yarn + - name: Install dependencies + run: yarn install --frozen-lockfile + - name: Test building the website + run: yarn build Check-Target-Branch: if: ${{ github.actor != 'dependabot[bot]' }} From fb236ef5e90b8196eca30223edeb6722bea5d812 Mon Sep 17 00:00:00 2001 From: Peter Harrison <16875803+palisadoes@users.noreply.github.com> Date: Tue, 31 Dec 2024 07:59:29 -0800 Subject: [PATCH 6/6] Comments --- .github/workflows/pull-request.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index 09e68cbf709..a9f5e1db4cd 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -102,7 +102,7 @@ jobs: Test-Docusaurus-Deployment: name: Test Deployment to https://docs.talawa.io runs-on: ubuntu-latest - # needs: [Code-Quality-Checks] + needs: [Code-Quality-Checks] # Run only if the develop branch and not dependabot if: ${{ github.actor != 'dependabot[bot]' && github.event.pull_request.base.ref == 'develop' }} steps: