Closed JanneMattila closed 3 years ago
Error The title of this pull request isn't what I expected!
Solution Verify the name of your pull request is Create a workflow and keep in mind that this is case-sensitive.
Follow these steps to rename your pull request:
I'll respond when I detect this pull request has been renamed.
Great job adding the workflow. Adding that file to this branch is enough for GitHub Actions to begin running on your repository. The time this takes will vary based on the complexity of the workflow. While this runs I'll briefly explain the components of the workflow you just added.
If you want to inspect your running workflow you can do so by heading over to the Actions tab of this repository.
GitHub Actions is a unique world that lives alongside your repository. It is one made up of many moving parts and having a general understanding of these parts will help us understand the behavior we are going to program into our action.
From 30,000 feet GitHub Actions is made up of the following components, with each component having its own complexities:
Component | Description |
---|---|
Action | Individual tasks that you combine as steps to create a job. Actions are the smallest portable building block of a workflow. To use an action in a workflow, you must include it as a step. |
Artifact | Artifacts are the files created when you build and test your code. Artifacts might include binary or package files, test results, screenshots, or log files. Artifacts can be used by the other jobs in the workflow or deployed directly by the workflow. |
Event | A specific activity that triggers a workflow run. |
Job | A defined task made up of steps. Each job is run in a fresh instance of the virtual environment. Jobs can run at the same time in parallel or be dependent on the status of a previous job and run sequentially. |
Runner | Any machine with the GitHub Actions runner application installed. You can use a runner hosted by GitHub or host your own runner. A runner waits for available jobs. Runners run one job at a time reporting the progress, logs, and final result back to GitHub. |
Step | A step is a set of tasks performed by a job. Steps can run commands or actions. |
Virtual Environment | The virtual environment of a GitHub-hosted runner includes the virtual machine's hardware configuration, operating system, and installed software. |
Workflow | A configurable automated process that you can set up in your repository. Workflows are made up of one or more jobs and can be scheduled or activated by an event. |
When a repository is configured with a workflow file, like we just created, the following series of events occurs.
I'm glad you asked. Let's take a look at a workflow file similar to what we just committed to this repository.
name: CI
on: [push]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Run a one-line script
run: echo Hello, world!
- name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
This file is made up of a series of metadata, as well as behaviors that we wish to happen when the workflow is triggered.
Let's take a second to talk about each of the pieces that we see here:
name: CI
CI
on: [push]
Jobs:
build
runs-on: ubuntu-latest
uses: actions/checkout@v1
name: Run a one-line script
run: echo Hello, world!
name: Run a multi-line script
run: |
echo Add other actions to build,
echo test, and deploy your project.
📖Take a deeper dive into workflow components 📖Read more about configuring workflows
if you don't see a response from me below this, try making a new commit to this branch. Your workflow may have finished before I was ready to listen
:robot: I'm here to help you debug.
{"action":"completed","check_suite":{"id":3491883889,"node_id":"MDEwOkNoZWNrU3VpdGUzNDkxODgzODg5","head_branch":"add-initial-workflow","head_sha":"23248fabea701ff045d86ccab43d3438407e661e","status":"completed","conclusion":"success","url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/check-suites/3491883889","before":"0bdb1c1ef372aeb0a9dea1f5dade6dc3a59eb486","after":"23248fabea701ff045d86ccab43d3438407e661e","pull_requests":[{"url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/pulls/2","id":712232532,"number":2,"head":{"ref":"add-initial-workflow","sha":"23248fabea701ff045d86ccab43d3438407e661e","repo":{"id":395604344,"url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions","name":"writing-javascript-actions"}},"base":{"ref":"main","sha":"3153460b717d3eb73e592086fa8468a73c1e50ae","repo":{"id":395604344,"url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions","name":"writing-javascript-actions"}}}],"app":{"id":46505,"slug":"gitguardian","node_id":"MDM6QXBwNDY1MDU=","owner":{"login":"GitGuardian","id":27360172,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI3MzYwMTcy","avatar_url":"https://avatars.githubusercontent.com/u/27360172?v=4","gravatar_id":"","url":"https://api.github.com/users/GitGuardian","html_url":"https://github.com/GitGuardian","followers_url":"https://api.github.com/users/GitGuardian/followers","following_url":"https://api.github.com/users/GitGuardian/following{/other_user}","gists_url":"https://api.github.com/users/GitGuardian/gists{/gist_id}","starred_url":"https://api.github.com/users/GitGuardian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GitGuardian/subscriptions","organizations_url":"https://api.github.com/users/GitGuardian/orgs","repos_url":"https://api.github.com/users/GitGuardian/repos","events_url":"https://api.github.com/users/GitGuardian/events{/privacy}","received_events_url":"https://api.github.com/users/GitGuardian/received_events","type":"Organization","site_admin":false},"name":"GitGuardian","description":"## 🦉 What is GitGuardian ?\r\n\r\nGitGuardian is the ultimate security layer for developers.\r\nWe detect hard-coded secrets in commits and repositories, and help you with prevention and remediation.\r\n\r\n### 1. Scan your codebase for 200+ types of secrets\r\nGitGuardian scans your selected repositories and raises alerts only for critical secrets, such as API keys or other credentials. GitGuardian’s detection algorithm has been battle-tested, at scale, on over three years of activity in all public GitHub repositories.\r\n### 2. Easily remediate your hard-coded secrets\r\nIf you ever experience a leak involving a credential, we have a complete remediation guide used by 100k+ developers each year. We’ll show you how to revoke the secret and remove it from your git history.\r\n### 3. Prevent secrets from reaching your source code\r\nIntegrate your repositories with GitGuardian Shield and stem the flow of secrets that reach GitHub. Our app will let you know if your commit contains a secret, giving you valuable information at the right moment..\r\n\r\n\r\n\r\n## 🙋♂️ FAQ\r\n\r\nWhat is your pricing?\r\nGitGuardian is free for teams under 25 developers and offers a 30-day free trial for larger teams.\r\n\r\nHow can I be sure that GitGuardian won't raise too many false positives?\r\nWe have scanned billions of commits, sent millions of alerts since 2018, and integrated each feedback to improve our algorithm. Our alerts currently receive a 91% “true positive” feedback from developers.\r\n\r\nMy repositories are private, why should I install automated secret detection?\r\nImagine if there was a plain text file with all your credit card numbers inside, you wouldn’t put this file inside your company's git repository. Secrets are just as sensitive and should be handled with special care.\r\n\r\nIs GitGuardian available to be installed on-premise?\r\nYes, you can reach out to one of our security specialists to evaluate the possibility of installing GitGuardian on-premise on your repositories.\r\n\r\n\r\n\r\n ## ⚒️ Installation notes \r\n\r\nYou should install GitGuardian directly through your GitGuardian workspace, in the Integration settings page. \r\n\r\nPlease note that your GitHub organization and/or GitHub account can only be associated with a single GitGuardian workspace. \r\n\r\n\r\n\r\n## 👋 Support\r\n\r\nIf you experience any difficulties or have any questions, please reach out to us by email (support@gitguardian.com).","external_url":"https://dashboard.gitguardian.com","html_url":"https://github.com/apps/gitguardian","created_at":"2019-11-12T15:44:31Z","updated_at":"2021-07-05T06:52:46Z","permissions":{"checks":"write","contents":"read","emails":"read","issues":"write","members":"read","metadata":"read","organization_hooks":"write","pull_requests":"write"},"events":["check_run","check_suite","commit_comment","create","delete","public","pull_request","pull_request_review","pull_request_review_comment","push","repository"]},"created_at":"2021-08-13T10:50:12Z","updated_at":"2021-08-13T10:50:14Z","latest_check_runs_count":1,"check_runs_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/check-suites/3491883889/check-runs","head_commit":{"id":"23248fabea701ff045d86ccab43d3438407e661e","tree_id":"d0508e0752b07e4a9a2d86b4bf6fa8834e9ceeb1","message":"Update my-workflow.yml","timestamp":"2021-08-13T10:50:12Z","author":{"name":"Janne Mattila","email":"janne.mattila@hotmail.fi"},"committer":{"name":"GitHub","email":"noreply@github.com"}}},"repository":{"id":395604344,"node_id":"MDEwOlJlcG9zaXRvcnkzOTU2MDQzNDQ=","name":"writing-javascript-actions","full_name":"JanneMattila/writing-javascript-actions","private":false,"owner":{"login":"JanneMattila","id":2357647,"node_id":"MDQ6VXNlcjIzNTc2NDc=","avatar_url":"https://avatars.githubusercontent.com/u/2357647?v=4","gravatar_id":"","url":"https://api.github.com/users/JanneMattila","html_url":"https://github.com/JanneMattila","followers_url":"https://api.github.com/users/JanneMattila/followers","following_url":"https://api.github.com/users/JanneMattila/following{/other_user}","gists_url":"https://api.github.com/users/JanneMattila/gists{/gist_id}","starred_url":"https://api.github.com/users/JanneMattila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanneMattila/subscriptions","organizations_url":"https://api.github.com/users/JanneMattila/orgs","repos_url":"https://api.github.com/users/JanneMattila/repos","events_url":"https://api.github.com/users/JanneMattila/events{/privacy}","received_events_url":"https://api.github.com/users/JanneMattila/received_events","type":"User","site_admin":false},"html_url":"https://github.com/JanneMattila/writing-javascript-actions","description":null,"fork":false,"url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions","forks_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/forks","keys_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/teams","hooks_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/hooks","issue_events_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/issues/events{/number}","events_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/events","assignees_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/assignees{/user}","branches_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/branches{/branch}","tags_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/tags","blobs_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/git/refs{/sha}","trees_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/statuses/{sha}","languages_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/languages","stargazers_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/stargazers","contributors_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/contributors","subscribers_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/subscribers","subscription_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/subscription","commits_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/commits{/sha}","git_commits_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/git/commits{/sha}","comments_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/comments{/number}","issue_comment_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/issues/comments{/number}","contents_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/contents/{+path}","compare_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/merges","archive_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/downloads","issues_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/issues{/number}","pulls_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/pulls{/number}","milestones_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/milestones{/number}","notifications_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/labels{/name}","releases_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/releases{/id}","deployments_url":"https://api.github.com/repos/JanneMattila/writing-javascript-actions/deployments","created_at":"2021-08-13T10:02:15Z","updated_at":"2021-08-13T10:02:20Z","pushed_at":"2021-08-13T10:50:13Z","git_url":"git://github.com/JanneMattila/writing-javascript-actions.git","ssh_url":"git@github.com:JanneMattila/writing-javascript-actions.git","clone_url":"https://github.com/JanneMattila/writing-javascript-actions.git","svn_url":"https://github.com/JanneMattila/writing-javascript-actions","homepage":"https://lab.github.com/githubtraining/github-actions:-writing-javascript-actions","size":0,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":1,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":0,"open_issues":1,"watchers":0,"default_branch":"main"},"sender":{"login":"JanneMattila","id":2357647,"node_id":"MDQ6VXNlcjIzNTc2NDc=","avatar_url":"https://avatars.githubusercontent.com/u/2357647?v=4","gravatar_id":"","url":"https://api.github.com/users/JanneMattila","html_url":"https://github.com/JanneMattila","followers_url":"https://api.github.com/users/JanneMattila/followers","following_url":"https://api.github.com/users/JanneMattila/following{/other_user}","gists_url":"https://api.github.com/users/JanneMattila/gists{/gist_id}","starred_url":"https://api.github.com/users/JanneMattila/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/JanneMattila/subscriptions","organizations_url":"https://api.github.com/users/JanneMattila/orgs","repos_url":"https://api.github.com/users/JanneMattila/repos","events_url":"https://api.github.com/users/JanneMattila/events{/privacy}","received_events_url":"https://api.github.com/users/JanneMattila/received_events","type":"User","site_admin":false},"installation":{"id":2833257,"node_id":"MDIzOkludGVncmF0aW9uSW5zdGFsbGF0aW9uMjgzMzI1Nw=="}}
Our workflow has finished so let's take a look at the results now that we have learned a little bit about workflows while we waited.
In the left-hand panel of this screen you can see that this workflow, named CI
was triggered on: push
and ran the job titled build
.
The right-hand panel shows real-time logging of the steps executed by the build
job. There are currently 5 steps defined for this job:
🤔This is interesting, in the my-workflow.yml
file we defined 3 steps, not 5, so what happened?
GitHub Actions will always add the Set up job
and Complete job
steps to each job in a workflow. These steps are what configure the virtual environment before running your steps and shut it down properly before moving onto the next job in your workflow.
If you recall, we had 1 step that used an action and 2 steps that ran commands, can you identify which step used the action?
If you want to see this for yourself head over to your [Actions tab]() and examine the workflow named CI
Currently my-workflow.yml
is not set up correctly for our use-case. It worked great for allowing us to take a high-level look at workflows, but if we want to use our custom actions there are some changes that we have to make to it.
Edit the my-workflow.yml
to have the following contents:
name: JS Actions
on: [push]
jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
I'll respond in this pull request once you make these changes.
@JanneMattila you're doing great so far 😄! You've had to do a lot of workflow set up so we can begin writing custom actions. We have just one more thing to add to our my-workflow.yml
file before we get to the action side of things.
Before we make our final workflow change let's do a quick recap about what we've done.
Action | Key Takeaways |
---|---|
Created my-workflow.yml inside of .github/workflows directory |
GitHub repositories look in the .github/workflows folder for workflow files. |
Used a templated workflow | GitHub provides many templates for workflow files. This is a great spot to look when setting up a new workflow. If you can't find what you are looking for, you can always click the setup a workflow yourself button for a minimal starter template |
Workflow environment | You learned, from a high level, how a repository uses a workflow file to run commands or actions based on triggers. You also learned that where these commands or actions execute is something that can be specified |
Workflow syntax | You were briefly introduced to the workflow YAML syntax. |
If that seems like a lot of things just to get started... well, it is! GitHub Actions is a robust platform designed to automate a wide range of tasks for your repositories.
If you'd like to see more examples of workflows and actions then check out these Learning Lab courses all about GitHub Actions:
Edit the my-workflow.yml
to contain the following:
name: JS Actions
on: [push]
jobs:
action:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: hello-action
uses: ./.github/actions/hello-world
I'll respond when I notice you've made these changes
Workflow files are the recipe for task automation. This is where actions are placed if I want to use them for a task.