From f3c325c7212ad97f9ccd91aad0b4dc8f91529266 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Sun, 14 Jan 2024 19:31:58 +0600 Subject: [PATCH 1/8] updated as per actionlint's evaluation --- .../workflows/notify-tsc-members-mention.yml | 25 ++++++++++--------- 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/notify-tsc-members-mention.yml b/.github/workflows/notify-tsc-members-mention.yml index d72fd85b..82baf417 100644 --- a/.github/workflows/notify-tsc-members-mention.yml +++ b/.github/workflows/notify-tsc-members-mention.yml @@ -66,10 +66,10 @@ jobs: CALENDAR_ID: ${{ secrets.CALENDAR_ID }} CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} + ISSUE_TITLE: ${{ github.event.issue.title }} with: script: | - const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); - sendEmail('${{github.event.issue.html_url}}', '${{github.event.issue.title}}'); + sendEmail('${{github.event.issue.html_url}}', process.env.ISSUE_TITLE); pull_request: if: github.event_name == 'pull_request_target' && contains(github.event.pull_request.body, '@asyncapi/tsc_members') @@ -111,10 +111,11 @@ jobs: CALENDAR_ID: ${{ secrets.CALENDAR_ID }} CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} + PR_TITLE: ${{ github.event.pull_request.title }} + with: script: | - const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); - sendEmail('${{github.event.pull_request.html_url}}', '${{github.event.pull_request.title}}'); + sendEmail('${{github.event.pull_request.html_url}}', process.env.PR_TITLE); discussion: if: github.event_name == 'discussion' && contains(github.event.discussion.body, '@asyncapi/tsc_members') @@ -156,10 +157,10 @@ jobs: CALENDAR_ID: ${{ secrets.CALENDAR_ID }} CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} + DISCUSSION_TITLE: ${{ github.event.discussion.title }} with: script: | - const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); - sendEmail('${{github.event.discussion.html_url}}', '${{github.event.discussion.title}}'); + sendEmail('${{github.event.discussion.html_url}}', process.env.DISCUSSION_TITLE); issue_comment: if: ${{ github.event_name == 'issue_comment' && !github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members') }} @@ -201,10 +202,10 @@ jobs: CALENDAR_ID: ${{ secrets.CALENDAR_ID }} CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} + ISSUE_TITLE: ${{ github.event.issue.title }} with: script: | - const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); - sendEmail('${{github.event.comment.html_url}}', '${{github.event.issue.title}}'); + sendEmail('${{github.event.comment.html_url}}', process.env.ISSUE_TITLE); pr_comment: if: github.event_name == 'issue_comment' && github.event.issue.pull_request && contains(github.event.comment.body, '@asyncapi/tsc_members') @@ -246,10 +247,10 @@ jobs: CALENDAR_ID: ${{ secrets.CALENDAR_ID }} CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} + PR_TITLE: ${{ github.event.issue.title }} with: script: | - const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); - sendEmail('${{github.event.comment.html_url}}', '${{github.event.issue.title}}'); + sendEmail('${{github.event.comment.html_url}}', process.env.PR_TITLE); discussion_comment: if: github.event_name == 'discussion_comment' && contains(github.event.comment.body, '@asyncapi/tsc_members') @@ -291,7 +292,7 @@ jobs: CALENDAR_ID: ${{ secrets.CALENDAR_ID }} CALENDAR_SERVICE_ACCOUNT: ${{ secrets.CALENDAR_SERVICE_ACCOUNT }} MAILCHIMP_API_KEY: ${{ secrets.MAILCHIMP_API_KEY }} + DISCUSSION_TITLE: ${{ github.event.discussion.title }} with: script: | - const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); - sendEmail('${{github.event.comment.html_url}}', '${{github.event.discussion.title}}'); + sendEmail('${{github.event.comment.html_url}}', process.env.DISCUSSION_TITLE); From 76fd564eedbdf9d85a6f6d8c926eb848b66465ed Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Tue, 16 Jan 2024 17:07:08 +0600 Subject: [PATCH 2/8] added mistakenly removed import --- .github/workflows/notify-tsc-members-mention.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/notify-tsc-members-mention.yml b/.github/workflows/notify-tsc-members-mention.yml index 82baf417..248749d1 100644 --- a/.github/workflows/notify-tsc-members-mention.yml +++ b/.github/workflows/notify-tsc-members-mention.yml @@ -69,6 +69,7 @@ jobs: ISSUE_TITLE: ${{ github.event.issue.title }} with: script: | + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); sendEmail('${{github.event.issue.html_url}}', process.env.ISSUE_TITLE); pull_request: @@ -115,6 +116,7 @@ jobs: with: script: | + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); sendEmail('${{github.event.pull_request.html_url}}', process.env.PR_TITLE); discussion: @@ -160,6 +162,7 @@ jobs: DISCUSSION_TITLE: ${{ github.event.discussion.title }} with: script: | + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); sendEmail('${{github.event.discussion.html_url}}', process.env.DISCUSSION_TITLE); issue_comment: @@ -205,6 +208,7 @@ jobs: ISSUE_TITLE: ${{ github.event.issue.title }} with: script: | + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); sendEmail('${{github.event.comment.html_url}}', process.env.ISSUE_TITLE); pr_comment: @@ -250,6 +254,7 @@ jobs: PR_TITLE: ${{ github.event.issue.title }} with: script: | + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); sendEmail('${{github.event.comment.html_url}}', process.env.PR_TITLE); discussion_comment: @@ -295,4 +300,5 @@ jobs: DISCUSSION_TITLE: ${{ github.event.discussion.title }} with: script: | + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); sendEmail('${{github.event.comment.html_url}}', process.env.DISCUSSION_TITLE); From 2453192bbb401a8c2f8766853a706b1671059de8 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Wed, 17 Jan 2024 18:53:40 +0600 Subject: [PATCH 3/8] add actionlint --- .github/workflows/validate-workflow-schema.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-workflow-schema.yml b/.github/workflows/validate-workflow-schema.yml index d13d3680..0cc95f25 100644 --- a/.github/workflows/validate-workflow-schema.yml +++ b/.github/workflows/validate-workflow-schema.yml @@ -14,6 +14,16 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 + - name: Install actionlint + run: | + curl -sLO https://github.com/rhysd/actionlint/releases/download/v1.6.3/actionlint_1.6.3_linux_amd64.tar.gz + tar xzf actionlint_1.6.3_linux_amd64.tar.gz + chmod +x actionlint + sudo mv actionlint /usr/local/bin/ + + - name: Run actionlint + run: actionlint -color + - name: Install Dependencies run: npm install yaml-lint ajv axios js-yaml @@ -69,4 +79,4 @@ jobs: } } } - validateWorkflows(); \ No newline at end of file + validateWorkflows(); From 6c64a728549b8e7fcd813828e79cb15098c5dd3a Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Wed, 17 Jan 2024 19:04:32 +0600 Subject: [PATCH 4/8] remove other dependencies --- .../workflows/validate-workflow-schema.yml | 60 +------------------ 1 file changed, 2 insertions(+), 58 deletions(-) diff --git a/.github/workflows/validate-workflow-schema.yml b/.github/workflows/validate-workflow-schema.yml index 0cc95f25..8a0b8fa4 100644 --- a/.github/workflows/validate-workflow-schema.yml +++ b/.github/workflows/validate-workflow-schema.yml @@ -22,61 +22,5 @@ jobs: sudo mv actionlint /usr/local/bin/ - name: Run actionlint - run: actionlint -color - - - name: Install Dependencies - run: npm install yaml-lint ajv axios js-yaml - - - name: Lint YAML Files - run: | - set -e - find .github/workflows -type f -name "*.yml" -print0 | xargs -0 ./node_modules/.bin/yamllint -q - - - name: List YAML files to validate - run: | - set -e - files=$(find .github/workflows -name '*.yml') - echo "Validating the following files:" - echo "$files" - - - name: Run YAML validation - uses: actions/github-script@v6 - with: - script: | - const Ajv = require("ajv"); - const axios = require("axios"); - const yaml = require("js-yaml"); - const fs = require("fs").promises; - - async function validateWorkflows() { - const schema = await axios.get( - "https://raw.githubusercontent.com/SchemaStore/schemastore/master/src/schemas/json/github-workflow.json" - ); - - const files = await fs.readdir(".github/workflows"); - const ymlFiles = files.filter((file) => file.endsWith(".yml")); - - for (const file of ymlFiles) { - try { - const content = await fs.readFile(`.github/workflows/${file}`, "utf8"); - const target = yaml.load(content); - - const ajv = new Ajv({ strict: false, allErrors: true }); - const validator = ajv.compile(schema.data); - const valid = validator(target); - if (!valid) { - console.error( - `Validation failed for file '${file}' with the following errors:` - ); - console.error(validator.errors); - process.exitCode = 1; - } else { - console.log(`Workflow in file '${file}' is valid`); - } - } catch (error) { - console.error(`Error validating file '${file}': ${error.message}`); - process.exitCode = 1; - } - } - } - validateWorkflows(); + run: actionlint + From d136194fb6250972325fb6c18b154b5cf3a0af36 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Thu, 18 Jan 2024 11:28:50 +0600 Subject: [PATCH 5/8] update yml lint --- .github/workflows/validate-workflow-schema.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/validate-workflow-schema.yml b/.github/workflows/validate-workflow-schema.yml index 8a0b8fa4..96dca2c1 100644 --- a/.github/workflows/validate-workflow-schema.yml +++ b/.github/workflows/validate-workflow-schema.yml @@ -23,4 +23,4 @@ jobs: - name: Run actionlint run: actionlint - + \ No newline at end of file From cabc82222790014de31494275699655ece5c3f8f Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Thu, 18 Jan 2024 16:32:14 +0600 Subject: [PATCH 6/8] update actionlint download process --- .../workflows/validate-workflow-schema.yml | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/.github/workflows/validate-workflow-schema.yml b/.github/workflows/validate-workflow-schema.yml index 96dca2c1..b883dd8b 100644 --- a/.github/workflows/validate-workflow-schema.yml +++ b/.github/workflows/validate-workflow-schema.yml @@ -11,16 +11,13 @@ jobs: yaml-lint: runs-on: ubuntu-latest steps: - - name: Checkout Code - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: Install actionlint - run: | - curl -sLO https://github.com/rhysd/actionlint/releases/download/v1.6.3/actionlint_1.6.3_linux_amd64.tar.gz - tar xzf actionlint_1.6.3_linux_amd64.tar.gz - chmod +x actionlint - sudo mv actionlint /usr/local/bin/ + - name: Download actionlint + id: get_actionlint + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + shell: bash - - name: Run actionlint - run: actionlint - \ No newline at end of file + - name: Check workflow files + run: ${{ steps.get_actionlint.outputs.executable }} -color + shell: bash From e99a535ac5a764d241bd0ef600a1d54b341d6927 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Thu, 18 Jan 2024 16:36:58 +0600 Subject: [PATCH 7/8] add name --- .github/workflows/validate-workflow-schema.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/validate-workflow-schema.yml b/.github/workflows/validate-workflow-schema.yml index b883dd8b..61180b1c 100644 --- a/.github/workflows/validate-workflow-schema.yml +++ b/.github/workflows/validate-workflow-schema.yml @@ -11,7 +11,8 @@ jobs: yaml-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Code + uses: actions/checkout@v2 - name: Download actionlint id: get_actionlint From d75e6fbb39238f209e06f6968a49c47b6674d9f1 Mon Sep 17 00:00:00 2001 From: Mahfuza Humayra Mohona Date: Wed, 8 May 2024 08:23:44 +0600 Subject: [PATCH 8/8] add gitHub action for actionlint --- .github/workflows/validate-workflow-schema.yml | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/.github/workflows/validate-workflow-schema.yml b/.github/workflows/validate-workflow-schema.yml index 61180b1c..bd86bd98 100644 --- a/.github/workflows/validate-workflow-schema.yml +++ b/.github/workflows/validate-workflow-schema.yml @@ -14,11 +14,5 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - name: Download actionlint - id: get_actionlint - run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) - shell: bash - - name: Check workflow files - run: ${{ steps.get_actionlint.outputs.executable }} -color - shell: bash + uses: raven-actions/actionlint@v1 \ No newline at end of file