Skip to content

πŸ› Fix GitHub event object in push-change-to-discord-webhook-url.yml #2

πŸ› Fix GitHub event object in push-change-to-discord-webhook-url.yml

πŸ› Fix GitHub event object in push-change-to-discord-webhook-url.yml #2

name: Push Change to Discord Webhook URL
on:
push:
branches:
- main
- 'tmp/receive-commit-to-trigger-GHA'
# Allow manual trigger
workflow_dispatch:
jobs:
parse_commit_message:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Parse commit message
id: parse_commit_message
uses: actions/github-script@v4
with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const message = github.event.head_commit.message;
const regex = /discord-webhook-url: (.*)/g;
const match = regex.exec(message);
console.log(match[1]);
console.log(`::set-output name=webhook_url::${match[1]}`)