Skip to content

Instantly share code, notes, and snippets.

@jaymon0703
Last active June 17, 2021 20:05
Show Gist options
  • Save jaymon0703/416485cc8fd71ff275a6cdcd96e0c17f to your computer and use it in GitHub Desktop.
Save jaymon0703/416485cc8fd71ff275a6cdcd96e0c17f to your computer and use it in GitHub Desktop.
A YAML file for running an R-CMD-check on Ubuntu-latest using the rcmdcheck package and notifying Slack
name: R-CMD-check
on:
- push
- pull_request
jobs:
build:
runs-on: ubuntu-latest
env:
GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }}
steps:
- name: Notify slack success
if: success()
id: slack # IMPORTANT: reference this step ID value in future Slack steps
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
channel_id: <insert your channel ID here. For info on how to get your channel ID, see the accepted answer to this SO question - https://stackoverflow.com/questions/40940327/what-is-the-simplest-way-to-find-a-slack-team-id-and-a-channel-id>
status: STARTING
color: warning
- uses: actions/checkout@v2
- uses: r-lib/actions/setup-r@v1
- name: Install dependencies
run: |
install.packages(c("remotes", "rcmdcheck"))
remotes::install_deps(dependencies = TRUE)
shell: Rscript {0}
- name: Check
run: |
options(crayon.enabled = TRUE)
rcmdcheck::rcmdcheck(args = "--no-manual", error_on = "error", build_args = c("--no-manual", "--no-build-vignettes"))
shell: Rscript {0}
- name: Notify slack success
if: success()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
# Updates existing message from the first step
message_id: ${{ steps.slack.outputs.message_id }}
channel_id: <insert your channel ID here>
status: SUCCESS
color: good
- name: Notify slack fail
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@v1
with:
# Updates existing message from the first step
message_id: ${{ steps.slack.outputs.message_id }}
channel_id: <insert your channel ID here>
status: FAILED
color: danger
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment