3. ๊ฐ๋จํ ์ํฌํ๋ก์ฐ ๋ง๋ค๊ธฐ
๊นํ ๋ ํฌ ์์ฑ ์๋ํ
name: create-repo
on:
workflow_dispatch:
inputs:
prefix:
description: 'set repo prefix'
required: true
default: 'service'
type: choice
options:
- example
- service
name:
description: 'set repo name'
required: true
default: 'github-actions'
type: string
jobs:
create-repo-automation:
runs-on: ubuntu-latest
steps:
- name: gh auth login
run: |
echo ${{ secrets.PERSONAL_ACCESS_TOKEN }} | gh auth login --with-token
- name: create-repo
id: create-repo
run: |
gh repo create sangwon-action/${{ inputs.prefix }}-${{ inputs.name }} --public --add-readme
- name: slack
if: always()
uses: slackapi/slack-github-action@v1.24.0
with:
payload: |
{
"attachments": [
{
"pretext": "create repo result",
"color": "28a745",
"fields": [
{
"title": "create repo result ${{ steps.create-repo.outcome }}",
"short": true,
"value": "${{ inputs.prefix }}-${{ inputs.name }}"
}
]
}
]
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
- ๋ ํฌ์งํ ๋ฆฌ ํ ํฐ, ์ฌ๋ ์น๋ถ url๊ฐ์ secret ์ผ๋ก ์ ์ฅํด์ ์ฌ์ฉํจ
- ๋ ํฌ ์์ฑ ์ gh cli (github cli) ์ฌ์ฉํจ
- gh cli : ํฐ๋ฏธ๋์์ github ๊ธฐ๋ฅ์ ์ปค๋งจ๋๋ก ์ ์ด ๊ฐ๋ฅํจ
- ๋ ํฌ์งํ ๋ฆฌ, ์ด์, ํ ๋ฆฌํ์คํธ, ๊นํ ์ก์ ๋ฑ ๊ด๋ฆฌ
- ๊นํ ๋ฌ๋์์ ๊ธฐ๋ณธ์ ์ผ๋ก ์ฌ์ฉ ๊ฐ๋ฅํจ
- if: always() ์ฌ์ฉํ๋ฉด ์ฒซ๋ฒ์งธ step์ด ์คํจํ๋๋ผ๋ ๋๋ฒ์งธ step์ ๊ฐ์ ๋ก ์คํํ ์ ์์
'๐ฅ๏ธ ๋ฐฑ์๋ > CICD' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
[CICD] ๊ธฐ์ด ์๋๋ฆฌ์ค ๊นํ ์ก์ (0) | 2024.03.23 |
---|---|
[CICD] ํค์๋ ๊ธฐ๋ฐ ์ด์ ์๋ฆผ ์๋ํ (0) | 2024.03.23 |
[CICD] Github Actions์ ๋ค์ํ ๊ธฐ๋ฅ (0) | 2024.03.22 |
[CICD] Github Actions์ event (0) | 2024.03.21 |
[CICD] ๊นํ๋ธ ์ก์ ์ปดํฌ๋ํธ (0) | 2024.03.21 |