Skip to content

chore: "->' 수정

chore: "->' 수정 #6

name: Notify Slack on Push to main
on:
push:
branches: [main]
jobs:
notify:
runs-on: ubuntu-latest
env:
TZ: Asia/Seoul
steps:
- name: Get KST time
run: echo "KST_NOW=$(date '+%Y-%m-%d %H:%M KST')" >> "$GITHUB_ENV"
- name: Build message
id: msg
uses: actions/github-script@v7
with:
script: |
const commits = context.payload.commits || [];
const lines = commits.slice(0, 10).map(c => {
const author = c.author?.username || c.author?.name || 'unknown';
const title = (c.message || '').split('\n')[0];
return `• ${title} — ${author}`;
});
core.setOutput('summary', lines.join('\n') || '— (no commits captured) —');
- name: Post to Slack
uses: slackapi/[email protected]
with:
payload: |
{
"text": ":rocket: main에 변경사항 푸시됨",
"blocks": [
{
"type": "header",
"text": { "type": "plain_text", "text": "📌 main 브랜치 업데이트" }
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format('*리포지토리*: <{0}/{1}|{1}>\n*푸시한 유저*: {2}\n*시간(KST)*: {3}', github.server_url, github.repository, github.actor, env.KST_NOW)) }}
}
},
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": ${{ toJSON(format('*커밋 요약*:\n{0}', steps.msg.outputs.summary)) }}
}
},
{ "type": "divider" },
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "🔔 *로컬/포크 최신화*\n```bash\ngit checkout main\ngit pull --rebase origin main\n# (포크)\ngit fetch upstream\ngit rebase upstream/main\n```"
}
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK