diff --git a/.github/workflows/notify-tsc-members-mention.yml b/.github/workflows/notify-tsc-members-mention.yml index d72fd85b..248749d1 100644 --- a/.github/workflows/notify-tsc-members-mention.yml +++ b/.github/workflows/notify-tsc-members-mention.yml @@ -66,10 +66,11 @@ 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 +112,12 @@ 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}}'); + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); + 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 +159,11 @@ 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}}'); + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); + 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 +205,11 @@ 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}}'); + const sendEmail = require('./.github/workflows/scripts/mailchimp/index.js'); + 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 +251,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.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 +297,8 @@ 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); diff --git a/.github/workflows/validate-workflow-schema.yml b/.github/workflows/validate-workflow-schema.yml index d13d3680..bd86bd98 100644 --- a/.github/workflows/validate-workflow-schema.yml +++ b/.github/workflows/validate-workflow-schema.yml @@ -14,59 +14,5 @@ jobs: - name: Checkout Code uses: actions/checkout@v2 - - 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(); \ No newline at end of file + - name: Check workflow files + uses: raven-actions/actionlint@v1 \ No newline at end of file