From 1469f194af441dfc3291c97ed1992e6768adb0ab Mon Sep 17 00:00:00 2001 From: rithviknishad Date: Fri, 31 Jan 2025 22:15:54 +0530 Subject: [PATCH] Cleanup: Remove unnecessary GitHub workflows and update linter Node.js version --- .github/workflows/auto-testing-label.yml | 56 ---------------------- .github/workflows/combine.yml | 23 --------- .github/workflows/comment-p1-issues.yml | 43 ----------------- .github/workflows/label-deploy-failed.yml | 41 ---------------- .github/workflows/label-merge-conflict.yml | 3 +- .github/workflows/label-wip.yml | 54 --------------------- .github/workflows/linter.yml | 3 +- 7 files changed, 3 insertions(+), 220 deletions(-) delete mode 100644 .github/workflows/auto-testing-label.yml delete mode 100644 .github/workflows/combine.yml delete mode 100644 .github/workflows/comment-p1-issues.yml delete mode 100644 .github/workflows/label-deploy-failed.yml delete mode 100644 .github/workflows/label-wip.yml diff --git a/.github/workflows/auto-testing-label.yml b/.github/workflows/auto-testing-label.yml deleted file mode 100644 index 6d3cbd92ca4..00000000000 --- a/.github/workflows/auto-testing-label.yml +++ /dev/null @@ -1,56 +0,0 @@ -name: Auto Add Needs Testing Label - -on: - pull_request: - types: [opened, reopened, edited] - issue_comment: - types: [created] - pull_request_review: - types: [submitted] - -jobs: - auto_label: - runs-on: ubuntu-24.04-arm - - steps: - - name: Check PR Conditions and Add Label - id: check_conditions - uses: actions/github-script@v7 - with: - github-token: ${{ secrets.GITHUB_TOKEN }} - script: | - const pr = context.payload.pull_request; - const comment = context.payload.comment; - const review = context.payload.review; - - if (pr) { - const isDraft = pr.draft; - const isReadyForTestingComment = comment && comment.body.includes('ready for testing'); - const isChangesRequired = review && review.state === 'changes_requested'; - - if ((isReadyForTestingComment && !isDraft) || (!isDraft && pr.draft_changed)) { - await github.issues.addLabels({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr.number, - labels: ['needs testing'] - }); - } - - if (isChangesRequired) { - await github.rest.issues.createComment({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr.number, - body: 'Reminder: To add the "needs testing" label, comment "ready for testing" on this PR.' - }); - if (pr.labels.some(label => label.name === 'needs testing')) { - await github.issues.removeLabel({ - owner: context.repo.owner, - repo: context.repo.repo, - issue_number: pr.number, - name: 'needs testing' - }); - } - } - } diff --git a/.github/workflows/combine.yml b/.github/workflows/combine.yml deleted file mode 100644 index d908ffeec23..00000000000 --- a/.github/workflows/combine.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: Combine Dependencies - -on: workflow_dispatch - -# The minimum permissions required to run this Action -permissions: - contents: write - pull-requests: write - checks: read - -jobs: - combine-prs: - runs-on: ubuntu-24.04-arm - - steps: - - name: Combine dependencies - id: combine-dependencies - uses: github/combine-prs@v5.2.0 - with: - pr_title: Combined dependencies # The title of the pull request to create - select_label: dependencies # The label which marks PRs that should be combined. - labels: combined-dependencies # Add a label to the combined PR - ci_required: "false" # Whether or not CI should be passing to combine the PR diff --git a/.github/workflows/comment-p1-issues.yml b/.github/workflows/comment-p1-issues.yml deleted file mode 100644 index 4a7c5f97339..00000000000 --- a/.github/workflows/comment-p1-issues.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: Comment on P1 issues - -on: - issues: - types: - - labeled - -jobs: - add-comment: - if: github.event.label.name == 'P1' && github.repository == 'ohcnetwork/care_fe' - runs-on: ubuntu-24.04-arm - permissions: - issues: write - steps: - - name: Add comment - uses: actions/github-script@v7 - with: - script: | - const body = ':warning: **Refrain from assigning this issue to yourself if you have another `P1` issue assigned that is not yet closed.**' - const options = { - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - } - - const result = await github.rest.issues.get({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - }) - - const { assignees } = result.data - - if (assignees.length == 0) { - await github.rest.issues.createComment({ ...options, body }) - return - } - - const assignees_tagged = assignees.map((user) => '@' + user.login).join(' ') - await github.rest.issues.createComment({ - ...options, - body: body + `\n ${assignees_tagged} kindly acknowledge this message by commenting 'Acknowledged' below.`, - }) diff --git a/.github/workflows/label-deploy-failed.yml b/.github/workflows/label-deploy-failed.yml deleted file mode 100644 index 1907d87f8e9..00000000000 --- a/.github/workflows/label-deploy-failed.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Auto label failed preview deploys - -permissions: - pull-requests: write - -on: - issue_comment: - types: - - created - - edited - -jobs: - auto-label-deploy-failed: - runs-on: ubuntu-24.04-arm - if: | - github.repository == 'ohcnetwork/care_fe' && github.event.issue.pull_request && - contains(github.event.comment.body, 'Deploy Preview') - steps: - - name: Add 'Deploy-Failed' - if: contains(github.event.comment.body, 'failed') - uses: actions/github-script@v7 - with: - script: | - github.rest.issues.addLabels({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ["Deploy-Failed"] - }) - - - name: Remove 'Deploy-Failed' label - if: contains(github.event.comment.body, 'ready') - uses: actions/github-script@v7 - with: - script: | - github.rest.issues.removeLabel({ - issue_number: context.issue.number, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ["Deploy-Failed"] - }) diff --git a/.github/workflows/label-merge-conflict.yml b/.github/workflows/label-merge-conflict.yml index 8c0b06e5baa..5c3293e48ce 100644 --- a/.github/workflows/label-merge-conflict.yml +++ b/.github/workflows/label-merge-conflict.yml @@ -24,5 +24,6 @@ jobs: wait_ms: 15000 detect_merge_changes: false conflict_comment: | - :wave: Hi, @${author}, Conflicts have been detected against the base branch. Please rebase your branch against the base branch. + cc: @${author} + > _See: https://docs.ohc.network/docs/contributing#how-to-resolve-merge-conflicts_ diff --git a/.github/workflows/label-wip.yml b/.github/workflows/label-wip.yml deleted file mode 100644 index 8515c00a00c..00000000000 --- a/.github/workflows/label-wip.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Auto Label WIP -on: - pull_request_target: - types: - - opened - - reopened - - edited - - closed - -jobs: - check-linked-issues: - if: github.repository == 'ohcnetwork/care_fe' - name: Check linked issues - runs-on: ubuntu-24.04-arm - outputs: - linked_issues: ${{ steps.issue-output.outputs.linked_issues }} - steps: - - name: Get issues - id: get-issues - uses: mondeja/pr-linked-issues-action@v2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Set output - id: issue-output - run: echo "linked_issues=${{ steps.get-issues.outputs.issues }}" >> $GITHUB_OUTPUT - - label-issues: - name: Label linked issues - runs-on: ubuntu-24.04-arm - needs: check-linked-issues - permissions: write-all - if: github.repository == 'ohcnetwork/care_fe' && join(needs.check-linked-issues.outputs.linked_issues) != '' - steps: - - name: Label - uses: actions/github-script@v7 - with: - script: | - const issues = "${{ needs.check-linked-issues.outputs.linked_issues }}".split(',') - for (const issue of issues) { - if ("${{ github.event.pull_request.state }}" == "open") - github.rest.issues.addLabels({ - issue_number: issue, - owner: context.repo.owner, - repo: context.repo.repo, - labels: ["work-in-progress"] - }) - else - github.rest.issues.removeLabel({ - issue_number: issue, - owner: context.repo.owner, - repo: context.repo.repo, - name: ["work-in-progress"] - }) - } diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml index fb3209dfb02..7b2ff575aa8 100644 --- a/.github/workflows/linter.yml +++ b/.github/workflows/linter.yml @@ -4,7 +4,6 @@ on: pull_request: branches: - develop - - master merge_group: jobs: @@ -22,7 +21,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version: "20" + node-version: "22" - name: Install dependencies run: npm ci