{"id":22591306,"url":"https://github.com/itzzjb/github-actions","last_synced_at":"2025-10-11T16:42:46.605Z","repository":{"id":236540158,"uuid":"792808323","full_name":"itzzjb/github-actions","owner":"itzzjb","description":"This is an introduction for Github-Actions. Automating the testing of a basic Python Flask application.","archived":false,"fork":false,"pushed_at":"2024-05-05T05:52:04.000Z","size":20,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-16T03:45:39.475Z","etag":null,"topics":["github-actions","github-secrets","workflows"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/itzzjb.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-04-27T16:31:25.000Z","updated_at":"2024-05-12T07:28:20.000Z","dependencies_parsed_at":null,"dependency_job_id":"b604b8c8-f20a-4a05-b6e8-4bee57a7300f","html_url":"https://github.com/itzzjb/github-actions","commit_stats":null,"previous_names":["itzzjb/github-actions-beginner","itzzjb/github-actions"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/itzzjb/github-actions","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzzjb%2Fgithub-actions","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzzjb%2Fgithub-actions/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzzjb%2Fgithub-actions/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzzjb%2Fgithub-actions/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/itzzjb","download_url":"https://codeload.github.com/itzzjb/github-actions/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/itzzjb%2Fgithub-actions/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279007973,"owners_count":26084369,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-11T02:00:06.511Z","response_time":55,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["github-actions","github-secrets","workflows"],"created_at":"2024-12-08T09:12:10.855Z","updated_at":"2025-10-11T16:42:46.585Z","avatar_url":"https://github.com/itzzjb.png","language":"Python","readme":"# I'm a Github Actions Beginner\n\n**Here we are only trying to execute Testing on an event. Deploying and Building is not done here for now.**\n\nGithub Actions allows us to run an action whenever some event occurs on our repository.\n\n**Events:**\n\n- Pushing some code to a branch\n- Creating a Pull request\n\n**Actions:**\n\n- Testing your code\n- Deploying your code\n- Building your code\n- Run automatic scripts that can do activities like compiling files, moving code around, cleaning up the code base, closing an issue etc.\n\nFor more information we can refer to [Github Actions Website](https://github.com/features/actions).\n\n\u003e [!IMPORTANT]\n\u003e We can run any workflow in on any github event.\n\n**Benefits:**\n\n- We can use runners that are hosted for major operating systems to build and test projects.\n\n  - Runners are hosted in VM or a container.\n  - Github will automatically spin up runners for us. (Free up to a certain amount of minutes per month).\n  - We can also use your own servers in cloud or on-prem to host runners too.\n\n- We can have matrix workflows to simultaneously test across multiple operating systems and versions of your runtime.\n\n- We can build, test, and deploy applications in a language of choice because github actions supports any language.\n\n\u003e [!NOTE]\n\u003e Mostly github actions is used every day to automatically the do the testing and making sure we don't put code that are potentially broken or doesn't pass any test to a main branch or production branch.\n\n**Created a basic flask application and unit tests for it.**\n\n## What we expect here ?\n\nWhenever we change something in the repository, we want to automatically run our test.\n\nWe need to write scripts to run all the test and check whether they are passed before we give someone the ability to merge the code.\n\n## Branch Protection Rules\n\nBy adding this, we can make the repository as no one is able to push directly to main or master branch. Instead they have to create a pull request if they want to contribute.\n\nMain / Master branch should be always clean and fully functioning. So, you don't want to accidentally push something to the main branch when working with multiple people.\n\nWe need to ensure that it pass all the different tests and the pull request should be approved in order to merge into the main / master branch.\n\n## Setting up a github workflow\n\n1. We need to create a `.github` directory in the root folder.\n2. Inside it we can create a directory called `workflows`. (We have other types of actions like deployment that can be added here too)\n3. We put all the syntax, triggers, scripts we want to run inside a `.yml` file. (Give a meaningful name for the workflow)\n\n## Defining the workflow\n\nYou can find github workflow triggers [Here](https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows).\n\nYou can visit the [Github Marketplace](https://github.com/marketplace) to find pre-written scripts and more.\n\n## Running Workflows\n\nHere we have created a workflow that will run only when we try to create a pull request.\n\nWe can create a new branch and make a pull request to check if the workflow is running correctly.\n\n## Using Github Secrets\n\nWe are removing the .env file from github because it may contain vulnerable information line API keys, Database passwords etc.\n\nWhen we are running workflows we need to we need to use those environment variables too. We can't just hard code it because we will be exposing them to the public.\n\n```yml\nenv:\n  MODE: \"dev\"\n```\n\nIn those cases, we can use **github secrets**.\n\n\u003e [!NOTE]\n\u003e This is just like an environment variable, except it will be encrypted by github and only be visible to and edited by an administrator of the repository.\n\n**Steps:**\n\n1. Go to settings of the repository.\n2. Go to `Environments` section and setup an environment.\n   - Here are are naming the new environment as `dev`\n3. Inside `dev` there is a `Environment Secrets` section where we can add those environment variables. (Name and Value)\n\nNow , you can use the secret as an environment variable in the workflow.\n\n```yml\nenv:\n  MODE: ${{ secrets.MODE }}\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzzjb%2Fgithub-actions","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fitzzjb%2Fgithub-actions","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fitzzjb%2Fgithub-actions/lists"}