From d68f6705480c9e8bb53e91d06ece05f5e0ce471b Mon Sep 17 00:00:00 2001 From: David Date: Wed, 27 Mar 2024 17:21:27 +0100 Subject: [PATCH] Update GitHub workflows to Node v20 (#174694) * update linter workflows * bump actions script to v7 * bump actions stale to v9 * update workspace recommendations * add expression markers --- .github/workflows/aglint.yml | 26 ++++++++++++----------- .github/workflows/assign-on-label.yml | 4 ++-- .github/workflows/change-on-reopen.yml | 8 +++---- .github/workflows/markdownlint.yml | 26 ++++++++++++----------- .github/workflows/rm-labels-on-closed.yml | 8 +++---- .github/workflows/stale_issues_gh.yml | 4 ++-- .github/workflows/stale_issues_high.yml | 4 ++-- .github/workflows/stale_issues_low.yml | 4 ++-- .vscode/extensions.json | 3 ++- 9 files changed, 46 insertions(+), 41 deletions(-) diff --git a/.github/workflows/aglint.yml b/.github/workflows/aglint.yml index 1349e8c6937..2f4dbc7beb4 100644 --- a/.github/workflows/aglint.yml +++ b/.github/workflows/aglint.yml @@ -1,7 +1,7 @@ name: AGLint env: - NODE_VERSION: 18 + NODE_VERSION: 20 on: push: @@ -38,24 +38,27 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile - # If the linter found any errors, it will exit with a non-zero code, - # which will cause the job to fail + # If the linter found any errors, it will exit with a non-zero code, which will cause the job to fail - name: Run AGLint run: yarn lint notify: name: Send Slack notification on failure runs-on: ubuntu-latest - # We should wait for the lint job to finish before handling the notification needs: lint - # With always() we can run this job even if the previous job failed, but we also - # should check if the event is push or the PR is coming from the same repository - if: ${{ always() && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) }} + # Run this job only if the previous job failed and the event was triggered by the 'AdguardTeam/AdguardFilters' repository + # Note: 'always()' is needed to run the notify job even if the lint job was failed + if: + ${{ + always() && + needs.lint.result == 'failure' && + github.repository == 'AdguardTeam/AdguardFilters' && + ( + github.event_name == 'push' || + github.event.pull_request.head.repo.full_name == github.repository + ) + }} steps: - # Get the workflow conclusion - - uses: technote-space/workflow-conclusion-action@v3 - - # Send a Slack notification if the conclusion is failure - uses: 8398a7/action-slack@v3 with: status: failure @@ -64,4 +67,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }} diff --git a/.github/workflows/assign-on-label.yml b/.github/workflows/assign-on-label.yml index 2ca18a8bddf..d389525267b 100644 --- a/.github/workflows/assign-on-label.yml +++ b/.github/workflows/assign-on-label.yml @@ -6,10 +6,10 @@ on: jobs: assign: - if: github.repository == 'AdguardTeam/AdguardFilters' + if: ${{ github.repository == 'AdguardTeam/AdguardFilters' }} runs-on: ubuntu-latest steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | diff --git a/.github/workflows/change-on-reopen.yml b/.github/workflows/change-on-reopen.yml index e4e1e0d0664..8ceb5ffe157 100644 --- a/.github/workflows/change-on-reopen.yml +++ b/.github/workflows/change-on-reopen.yml @@ -6,10 +6,10 @@ on: jobs: remove_labels_assignees: - if: github.repository == 'AdguardTeam/AdguardFilters' + if: ${{ github.repository == 'AdguardTeam/AdguardFilters' }} runs-on: ubuntu-latest steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -17,13 +17,13 @@ jobs: const repo = context.repo.repo; const issueNumber = context.issue.number; - var issueLabelsRaw = await github.rest.issues.listLabelsOnIssue({ + const issueLabelsRaw = await github.rest.issues.listLabelsOnIssue({ owner, repo, issue_number: issueNumber, }); - var issueLabels = issueLabelsRaw.data.map((el) => el.name); + const issueLabels = issueLabelsRaw.data.map((el) => el.name); const labelsToRemove = [ 'A: Resolved', 'A: Cannot reproduce', 'A: In progress', 'A: Waiting for data' ]; for (let label of labelsToRemove) { diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml index 7b7b3c604b1..4e751384585 100644 --- a/.github/workflows/markdownlint.yml +++ b/.github/workflows/markdownlint.yml @@ -1,7 +1,7 @@ name: markdownlint env: - NODE_VERSION: 18 + NODE_VERSION: 20 on: push: @@ -40,24 +40,27 @@ jobs: - name: Install dependencies run: yarn install --frozen-lockfile - # If the linter found any errors, it will exit with a non-zero code, - # which will cause the job to fail + # If the linter found any errors, it will exit with a non-zero code, which will cause the job to fail - name: Run markdownlint run: yarn markdownlint . notify: name: Send Slack notification on failure runs-on: ubuntu-latest - # We should wait for the lint job to finish before handling the notification needs: lint - # With always() we can run this job even if the previous job failed, but we also - # should check if the event is push or the PR is coming from the same repository - if: ${{ always() && (github.event_name == 'push' || github.event.pull_request.head.repo.full_name == github.repository) }} + # Run this job only if the previous job failed and the event was triggered by the 'AdguardTeam/AdguardFilters' repository + # Note: 'always()' is needed to run the notify job even if the lint job was failed + if: + ${{ + always() && + needs.lint.result == 'failure' && + github.repository == 'AdguardTeam/AdguardFilters' && + ( + github.event_name == 'push' || + github.event.pull_request.head.repo.full_name == github.repository + ) + }} steps: - # Get the workflow conclusion - - uses: technote-space/workflow-conclusion-action@v3 - - # Send a Slack notification if the conclusion is failure - uses: 8398a7/action-slack@v3 with: status: failure @@ -66,4 +69,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }} - if: ${{ env.WORKFLOW_CONCLUSION == 'failure' }} diff --git a/.github/workflows/rm-labels-on-closed.yml b/.github/workflows/rm-labels-on-closed.yml index 57164aa783f..6a4d428b2d8 100644 --- a/.github/workflows/rm-labels-on-closed.yml +++ b/.github/workflows/rm-labels-on-closed.yml @@ -6,10 +6,10 @@ on: jobs: remove_label: - if: github.repository == 'AdguardTeam/AdguardFilters' + if: ${{ github.repository == 'AdguardTeam/AdguardFilters' }} runs-on: ubuntu-latest steps: - - uses: actions/github-script@v6 + - uses: actions/github-script@v7 with: github-token: ${{ secrets.GITHUB_TOKEN }} script: | @@ -17,13 +17,13 @@ jobs: const repo = context.repo.repo; const issueNumber = context.issue.number; - var issueLabelsRaw = await github.rest.issues.listLabelsOnIssue({ + const issueLabelsRaw = await github.rest.issues.listLabelsOnIssue({ owner, repo, issue_number: issueNumber, }); - var issueLabels = issueLabelsRaw.data.map((el) => el.name); + const issueLabels = issueLabelsRaw.data.map((el) => el.name); const labelsToRemove = [ 'Unsorted' ]; for (let label of labelsToRemove) { diff --git a/.github/workflows/stale_issues_gh.yml b/.github/workflows/stale_issues_gh.yml index 80fdc5ee94e..d1838038702 100644 --- a/.github/workflows/stale_issues_gh.yml +++ b/.github/workflows/stale_issues_gh.yml @@ -7,10 +7,10 @@ on: jobs: stale: - if: github.repository == 'AdguardTeam/AdguardFilters' + if: ${{ github.repository == 'AdguardTeam/AdguardFilters' }} runs-on: ubuntu-latest steps: - - uses: actions/stale@v7 + - uses: actions/stale@v9 with: stale-issue-message: > This issue has been automatically marked as stale because it has been open for 4 days with no activity. diff --git a/.github/workflows/stale_issues_high.yml b/.github/workflows/stale_issues_high.yml index ef8380fe1d2..13e0aff3578 100644 --- a/.github/workflows/stale_issues_high.yml +++ b/.github/workflows/stale_issues_high.yml @@ -7,10 +7,10 @@ on: jobs: stale: - if: github.repository == 'AdguardTeam/AdguardFilters' + if: ${{ github.repository == 'AdguardTeam/AdguardFilters' }} runs-on: ubuntu-latest steps: - - uses: actions/stale@v7 + - uses: actions/stale@v9 with: stale-issue-message: > This issue has been automatically marked as stale because it has been open for 10 days with no activity. diff --git a/.github/workflows/stale_issues_low.yml b/.github/workflows/stale_issues_low.yml index b20a5acd5fd..1cf64be9d6c 100644 --- a/.github/workflows/stale_issues_low.yml +++ b/.github/workflows/stale_issues_low.yml @@ -7,10 +7,10 @@ on: jobs: stale: - if: github.repository == 'AdguardTeam/AdguardFilters' + if: ${{ github.repository == 'AdguardTeam/AdguardFilters' }} runs-on: ubuntu-latest steps: - - uses: actions/stale@v7 + - uses: actions/stale@v9 with: stale-issue-message: > This issue has been automatically marked as stale because it has been open for 4 days with no activity. diff --git a/.vscode/extensions.json b/.vscode/extensions.json index 4c18ab7ef8c..a6a0dd4e20d 100644 --- a/.vscode/extensions.json +++ b/.vscode/extensions.json @@ -1,6 +1,7 @@ { "recommendations": [ "adguard.adblock", - "davidanson.vscode-markdownlint" + "davidanson.vscode-markdownlint", + "github.vscode-github-actions" ] } \ No newline at end of file