GitHub Actions Workshop

Master GitHub Actions with hands-on labs and exercises. Learn how to automate workflows, run tests, deploy applications, and more using GitHub's powerful automation platform. This repository has everything you need to get started with continuous integration and continuous deployment.


Project maintained by prasadhonrao Hosted on GitHub Pages — Theme by mattgraham

Solution: Create and Run a Custom Composite Action to Print a Message and the Current Time

name: "Print Message and Time"
description: "Prints a custom message and the current date/time"
author: "Your Name"
inputs:
  message:
    description: "The message to print"
    required: true
    default: "Hello, GitHub Actions!"
outputs:
  timestamp:
    description: "The current date and time"
runs:
  using: "composite"
  steps:
    # Step 1: Print the input message
    - name: Print the message
      run: echo "Message: $"

    # Step 2: Capture and output the current time
    - name: Get current timestamp
      id: current_time
      run: echo "timestamp=$(date)" >> $GITHUB_ENV

    # Step 3: Set the output from the timestamp
    - name: Set action output
      run: echo "timestamp=$"
      shell: bash