Update github.js #171
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Push to Feishu Webhook | |
on: | |
push: | |
branches: [main, dev] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Push to Feishu Webhook | |
uses: actions/[email protected] | |
with: | |
script: | | |
const commit = await github.rest.repos.getCommit({ | |
owner: context.repo.owner, | |
repo: context.repo.repo, | |
ref: `${{ github.sha }}` | |
}) | |
const response = await fetch('https://open.feishu.cn/open-apis/bot/v2/hook/${{ secrets.FEISHU_HOOK_TOKEN }}', { | |
method: 'POST', // Adjust the method as needed | |
body: JSON.stringify({"msg_type": "text", | |
"content": {"text": `event: ${{ github.event_name }},\nref_name: [${{ github.ref_name }}](https://github.com/askman-dev/askman-chrome-extension/commits/${{ github.ref_name }}/),\nmessage: ${commit.data.commit.message}\nauthor: ${commit.data.commit.author.name}`}}), // Customize the payload | |
headers: { | |
'Content-Type': 'application/json', | |
}, | |
}); | |
console.log('Message sent:', response.status, response.statusText); |