.
을 누르면 깃헙 웹 에디터로 이동함 GitHub Actions Workflows
: 정해둔 이벤트가 실행되었을 때 깃헙 내부적으로 실행될 명령어들을 정해 놓는 작업Actions
-> new workflow
-> Set up this workflow
# This is a basic workflow to help you get started with Actions
name: Discord 알리미
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
# pull_request:
# branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
# workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2 # 지우면 안됨, 서버에서 클론받아 액션을 돌리고 checkout을 하는 과정이 필수적임
- name: 멋사 안녕
run: echo "멋사 안녕"
- name: Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
DISCORD_USERNAME: GitHub Actions
DISCORD_AVATAR: https://images.velog.io/images/nathan29849/post/344b519b-f338-45a9-8f24-75fe8f6253f5/image.png
uses: Ilshidur/action-discord@master
with:
args: "DOUGH GitHub Actions!: {{GITHUB_EVENT_NAME}}"
# args: 'The project {{ EVENT_PAYLOAD.repository.full_name }} has been deployed.'
# # Runs a single command using the runners shell
# - name: Run a one-line script
# run: echo Hello, world!
# # Runs a set of commands using the runners shell
# - name: Run a multi-line script
# run: |
# echo Add other actions to build,
# echo test, and deploy your project.
위와 같이 Github docs
에서 Github Actions에 대한 Environment variables
를 확인할 수 있고 이를 yml
에서 이용할 수 있다.
위의 yml
코드에서 아래에 해당하는 부분은 이 Environment variables
에서 가져온 변수이다.
args: "DOUGH GitHub Actions!: {{GITHUB_EVENT_NAME}}"