GitHub Actions are a seamless way to integrate automated tasks into your repository. Sometimes it’s helpful to leave a comment in the action’s YAML file. Yes! Workflow files in GitHub Actions support comments!
This tutorial shows you how to add comments to GitHub Actions workflow files.
GitHub Actions Series Overview
- Getting Started With Node.js
- Create a Testing Matrix
- Using MongoDB
- Using Redis
- Using MongoDB Replica Sets
- Run on Pull Request
- Customize the Job Name
- Run a Workflow When Creating a Tag
- Testing Against an Exact Node.js Version
- Trigger Builds on Schedule (Cron)
- How to Test Lerna Monorepos
- How to Add Comments in YAML Files
- Clone Another Repository
Add Comments in GitHub Actions YAML Files
A previous tutorial walked you through the process of running GitHub Actions on a schedule. You’re using a cron notation to define the schedule.
I can’t remember how to translate a given cron definition. The quickest way to know when the cron runs is by adding a comment.
Luckily comments are supported in the YAML configuration files of GitHub Action workflows. Comments start with a
# symbol. Everything in the same line coming after the
# symbol will be interpreted as a comment:
name: Run tests on: push: pull_request: schedule: - cron: '0 0 * * *' # every day at midnight jobs: test: runs-on: ubuntu-latest # Comments in YAML start with a # (hashtag symbol) # Comment your thoughts for yourself or coworkers :) steps: - name: …
- Run GitHub Actions on a Schedule tutorial, here on Future Studio