Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Are You Awake Yet Action #623

Open
1 of 2 tasks
eprice555 opened this issue Oct 24, 2023 · 2 comments
Open
1 of 2 tasks

Are You Awake Yet Action #623

eprice555 opened this issue Oct 24, 2023 · 2 comments

Comments

@eprice555
Copy link
Collaborator

eprice555 commented Oct 24, 2023

Part of the OSS Architecture track

Task

Suggestions: try this prompt with Copilot "how to create a spellcheck GitHub Action like this one https://github.com/marketplace/actions/are-they-awake-yet"

Or you can debug the following output:
To create a GitHub Action in your ProgramEquity/amplify repository like the "Are They Awake Yet?" action, you can follow these steps:

  1. Create a new GitHub repository for your action.

  2. Create a new file in your repository called Dockerfile with the following contents:


RUN apk add --no-cache curl
COPY entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

This Dockerfile sets up a Node.js environment and installs the curl package. It also copies the entrypoint.sh script to the container and sets it as the entrypoint.

  1. Create a new file in your repository called entrypoint.sh with the following contents:
#!/bin/sh -l

curl -s https://awake-api.herokuapp.com/awake/$1 | grep -q "true"
if [ $? -eq 0 ]; then
  echo "$1 is awake!"
  exit 0
else
  echo "$1 is asleep :("
  exit 1
fi

This shell script is the entrypoint for the Docker container. It uses the curl command to make a request to the "Are They Awake Yet?" API with the specified URL. It then uses grep to check if the response contains the string "true". If the URL is awake, it prints a success message and exits with code 0. If the URL is asleep, it prints a failure message and exits with code 1.

Create a new file in your repository called action.yml with the following contents:

name: Are They Awake Yet?
description: Check if a website is awake
inputs:
  url:
    description: 'The URL to check'
    required: true
runs:
  using: 'docker'
  image: 'Dockerfile'

This YAML file defines the GitHub Action. It specifies the name and description of the action, as well as an input for the URL to check. It also specifies that the action should run using Docker, and sets the Docker image to the Dockerfile we created earlier.

Commit and push your changes to the repository.

Use the actions/checkout action to check out the repository in your workflow.

Use the ProgramEquity/amplifyaction to run the "Are They Awake Yet?" action in your workflow, passing the URL to check as an input.

Resources:

@github-actions
Copy link

Hello there, thanks for opening your first issue. We welcome you to the community!

@manishapriya94 manishapriya94 changed the title [Hack Pod] Getting started with Actions [Architecture] Are You Awake Yet Action Oct 24, 2023
@manishapriya94 manishapriya94 added ✍️ documentation Improvements or additions to documentation good first issue Good for newcomers labels Oct 24, 2023
@JulieGunawan JulieGunawan self-assigned this Oct 25, 2023
@JulieGunawan
Copy link
Collaborator

@eprice555 @rcmtcristian I assigned myself for this issue, can I help out and support the team?

@Satoshi-Sh Satoshi-Sh self-assigned this Oct 26, 2023
This was referenced Nov 1, 2023
@dataeducator dataeducator self-assigned this Nov 8, 2023
@manishapriya94 manishapriya94 removed ✍️ documentation Improvements or additions to documentation 🏗 architecture labels Dec 8, 2023
@manishapriya94 manishapriya94 changed the title [Architecture] Are You Awake Yet Action [Workflow] Are You Awake Yet Action Dec 8, 2023
@manishapriya94 manishapriya94 changed the title [Workflow] Are You Awake Yet Action Are You Awake Yet Action Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: No status
Status: No status
Development

No branches or pull requests

6 participants