Now you’re ready to write the code to send out an SMS message every time you make a new push to the main branch of your repository. Your final main.yml file should look like this. The comments in the file explain all of the directives to use.
# This is a basic workflow to help you get started with Actions
name: Send SMS
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
# 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
# Runs a set of commands using the runners shell
- name: Plivo SMS
uses: plivo/actions-sms@v1
with:
# Phone number in your Plivo account to send the SMS from
fromPhoneNumber: ${{secrets.FROM_NUMBER}}
# Phone number to send the SMS to
toPhoneNumber: ${{secrets.TO_NUMBER}}
# The message you want to send
message: ‘💡There has been new release to ${{github.repository}}’
env:
# A Plivo auth_id. Can alternatively be stored in environment
PLIVO_AUTH_ID: ${{ secrets.PLIVO_AUTH_ID}}
# A Plivo auth_token. Can alternatively be stored in environment
PLIVO_AUTH_TOKEN: ${{ secrets.PLIVO_AUTH_TOKEN}}
As a developer, you’re probably quite busy and may not take a close look at new builds or deployments. You might not be aware when someone uploads an update or submits a pull request against a repository. Now you can stay up to date no matter where you are by adding SMS notifications to your GitHub workflow.