Skip to content

Create main.yml#3

Open
smartSRA wants to merge 2 commits into
mainfrom
smartSRA-patch-2
Open

Create main.yml#3
smartSRA wants to merge 2 commits into
mainfrom
smartSRA-patch-2

Conversation

@smartSRA

Copy link
Copy Markdown
Owner

No description provided.

@github-learning-lab

Copy link
Copy Markdown

Nice, you just added an action block to your workflow file! Here are some important details about why each part of the block exists and what each part does.

  • jobs: is the base component of a workflow run
  • build: is the identifier we're attaching to this job
  • name: is the name of the job, this is displayed on GitHub when the workflow is running
  • runs-on: defines the type of machine to run the job on. The machine can be either a GitHub-hosted runner or a self-hosted runner.
  • steps: the linear sequence of operations that make up a job
  • uses: actions/checkout@v1 uses a community action called checkout to allow the workflow to access the contents of the repository
  • uses: ./action-a provides the relative path to the action we created in the action-a directory of the repository
  • with: is used to specify the input variables that will be available to your action in the runtime environment. In this case, the input variable is MY_NAME, and it is currently initialized to "Mona".

Your action has been triggered!

Your repository now contains an action (defined in the /action-a/ folder) and a workflow (defined in the ./github/workflows/main.yml file).

This action will run any time a new commit is created or pushed to the remote repository. Since you just created a commit, the workflow should have been triggered. This might take a few minutes since it's the first time running in this repository.

Seeing your Action in action

The status of your action is shown here in the pull request (look for All checks have passed below), or you can click the "Actions" tab in your repository. From there you will see the actions that have run, and you can click on the action's "Log" link to view details.

View an action's log

Step 6: Trigger the workflow

⌨️ Activity: See your action trigger the workflow

You've done the work, now sit back and see your action trigger the workflow!


I will respond when I detect your action has run and reported a status.

Actions can take a minute or two to run. Sometimes, I also respond too fast for the page to update! If you don't see a response from your action, wait a few seconds and refresh the page.

@github-learning-lab

Copy link
Copy Markdown

Almost there, but the workflow didn't run.

Here's some possible reasons why:

  • files aren't in proper directories
  • your script isn't executable

Troubleshooting steps

Check out the action's output in the Actions tab.

You can also use the following to help you troubleshoot:

For /action-a/entrypoint.sh
Problem Solution
entrypoint.sh isn't executable. In your shell, run chmod +x action-a/entrypoint.sh on this branch and push it up to GitHub.
The file isn't called entrypoint.sh (case sensitive). Rename the file using the UI or your CLI.
The directory action-a doesn't exist. Create the action-a folder and move entrypoint.sh to action-a.
The entrypoint.sh file isn't inside the action-a folder. Move entrypoint.sh to action-a.
For /action-a/Dockerfile
Problem Solution
The file isn't called Dockerfile (case sensitive). Rename the file using the UI or your CLI.
The directory action-a doesn't exist. Create the action-a folder and move the Dockerfile to action-a.
The Dockerfile isn't inside the action-a folder. Move the Dockerfile to action-a.
For .github/workflows/main.yml
Problem Solution
There's some problem with your syntax in main.yml. Copy and paste the code exactly as is shown in this PR (check for extra spaces, symbols) or see if an error appears in the action logs.
The file isn't called main.yml (case sensitive). Rename the file using the UI or your CLI.
The directory .github/workflows doesn't exist. Create the .github/workflows folders and move main.yml to .github/workflows.
The main.yml file isn't inside the .github/workflows folder. Move main.yml to .github/workflows.

Next time you commit, your action will try to run. I'll respond when that occurs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant