Skip to content

fix: secret var fix #18

fix: secret var fix

fix: secret var fix #18

name: Merged to Main
on:
# Triggered when a pull request is closed and merged into the main branch
pull_request:
branches:
- main
types:
- closed
# Manually triggered workflow with inputs for title and body
workflow_dispatch:
inputs:
pr_number:
description: "PR Number"
default: "200"
required: true
env:
# Slack webhook secret
CC_RELEASE_SLACK_WH: ${{ secrets.CC_RELEASE_SLACK_WH }}
jobs:
# Job to handle merged pull requests
merged_to_main:
runs-on: ubuntu-latest
environment: cc_pr_merge
# Run the job when a pull request is merged into main and not triggered manually && github.event.pull_request.merged
if: ${{ github.event_name != 'workflow_dispatch' }}
env:
# Environment variable to store pull request details
PR_NUMBER: ${{ github.event.pull_request.number }}
steps:
# Checkout repository action
- name: Checkout repository
uses: actions/checkout@v4
- name: Install Octakit
run: |
npm i -D @octokit/rest
# Sending release notes to cc-changelog channel
- name: Sending Release Notes to cc-changelog slack channel
uses: actions/github-script@v7
with:
script: |
const {sendReleaseNotes} = require('./.github/workflows/src/send-slack.js')
sendReleaseNotes(process.env.PR_NUMBER,process.env.CC_RELEASE_SLACK_WH)
# Job to handle manually triggered workflow_dispatch events
workflow_dispatch_event:
runs-on: ubuntu-latest
environment: cc_pr_merge
# Run the job when the workflow is manually triggered
if: ${{ github.event_name == 'workflow_dispatch' }}
steps:
# Checkout repository action
- name: Check repository
uses: actions/checkout@v4
# Sending release notes to cc-changelog channel
- name: Sending Release Notes to cc-changelog slack channel
uses: actions/github-script@v7
# Set environment variables for repository URL, PR number,PR title, and PR description
env:
PR_NUMBER: ${{github.event.inputs.pr_number}}
with:
script: |
const {sendReleaseNotes} = require('./.github/workflows/src/send-slack.js')
sendReleaseNotes(process.env.PR_NUMBER,process.env.CC_RELEASE_SLACK_WH)