{"id":26219441,"url":"https://github.com/hngprojects/pr-deploy","last_synced_at":"2025-04-16T01:57:35.890Z","repository":{"id":250570448,"uuid":"834623907","full_name":"hngprojects/pr-deploy","owner":"hngprojects","description":null,"archived":false,"fork":false,"pushed_at":"2024-08-21T23:16:35.000Z","size":675,"stargazers_count":48,"open_issues_count":1,"forks_count":10,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-04-16T01:57:17.252Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hngprojects.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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-07-27T20:59:51.000Z","updated_at":"2025-01-08T05:43:06.000Z","dependencies_parsed_at":"2024-08-10T09:46:17.628Z","dependency_job_id":"72d3b98b-484a-4572-898f-819e22baafa8","html_url":"https://github.com/hngprojects/pr-deploy","commit_stats":null,"previous_names":["hngprojects/pr-deploy"],"tags_count":21,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fpr-deploy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fpr-deploy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fpr-deploy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hngprojects%2Fpr-deploy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hngprojects","download_url":"https://codeload.github.com/hngprojects/pr-deploy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249183107,"owners_count":21226141,"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","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":[],"created_at":"2025-03-12T14:18:00.454Z","updated_at":"2025-04-16T01:57:35.862Z","avatar_url":"https://github.com/hngprojects.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":" # About\n\nThis GitHub Action deploys pull requests in Docker containers, allowing you to test your changes in an isolated environment before merging. This documentation has been sectioned into two; First section for Contributors and the Second section for User\n\n\n\n## For Users\n\n## Usage\nPull request events trigger this action. It builds the Docker image for the pull request and deploys it in a new Docker container. This step calls the action tool in the workflow script\n```\nsteps:\n- uses: hngprojects/pr-deploy@v2.0.1\n```\n## Inputs\nThe following inputs are required to configure the GitHub Action. These inputs allow the action to connect to your server, specify the:\n- context, that is where the Dockerfile is located.\n- define the Dockerfile for deployment.\n- set the environmental variables in Github secrets.\n\nThe environmental variables needed for this tool version are:\n- SERVER_HOST\n- SERVER_PASSWORD\n- SERVER_USERNAME\n- SERVER_PORT\n\n### Example Workflow File\nTo help you get started quickly, here’s an example of configuring your GitHub Actions workflow file to deploy pull requests in Docker containers using this GitHub Action. This setup allows you to automatically build and deploy your application whenever a pull request is opened, ensuring your changes are tested in an isolated environment.\nYour workflow file should be formatted as follows:\n```\nname: PR Deploy\non:\n  pull_request:\n    types: [opened, synchronize, reopened, closed]\n\njobs:\n  deploy-pr:\n    environment: \n      name: preview\n      url: ${{ steps.deploy.outputs.preview-url }}\n    runs-on: ubuntu-latest\n    steps:\n      - name: Checkout to branch\n        uses: actions/checkout@v4\n      - id: deploy\n        name: Pull Request Deploy\n        uses: hngprojects/pr-deploy@2.0.1\n        with:\n          server_host: ${{ secrets.SERVER_HOST }}\n          server_username: ${{ secrets.SERVER_USERNAME }}\n          server_password: ${{ secrets.SERVER_PASSWORD }}\n          server_port: ${{ secrets.SERVER_PORT }}\n          comment: true\n          context: '.'\n          dockerfile: 'Dockerfile'\n          exposed_port: '5000'\n          host_volume_path: '/var/'\n          container_volume_path: '/var/'\n          github_token: ${{ secrets.GITHUB_TOKEN }}\n      - name: Print Preview Url\n        run: |\n          echo \"Preview Url: ${{ steps.deploy.outputs.preview-url }}\" \n```\n**NOTE**\n1. Github token is autogenerated, please do not declare it.\n2. You have the option to allow or disallow the Comment feature with the `true or false` argument. This feature lets you know the status of the deployment.\n3. Context feature specifies the location of your Dockerfile. \n\n## For Contributors\n### Overview\nThese tool made use of two files named:\n- action.yml\n- entrypoint.sh\n\n`action.yml`:\nThe file declares the inputs needed to deploy the pull request in isolated docker containers. \n\n`entrypoint.sh`:\nWith the aid of the inputs retrieved by the actions.yml file, the shell script automates the deployment process.\n\n### How to Contribute\n1. **Fork the Repository**: Start by forking the repository to your GitHub account.\n\n2. **Create a New Branch**: Create a branch for your feature or bugfix\n   ```\n    git checkout -b feature/your-feature-name\n   ```\n3. **Modify Inputs**: If adding new inputs or modifying existing ones:\n   - Ensure they are documented in action.yml.\n   - Update the shell script to handle these inputs appropriately.\n\n4. **Update Documentation**: Reflect any changes in the README.md file.\n\n5. **Commit Your Changes**: With a descriptive message:\n   ```\n   git commit -m 'Add feature: your-feature-name'\n\n   ```\n\n6. **Push to Your Branch**:\n   ```\n   git push origin feature/your-feature-name\n\n   ```\n \n\n## Troubleshooting tips:\n\n- If the action fails, check the GitHub Actions logs for detailed error messages.\n- Ensure that your server's firewall allows incoming connections on the SSH port and the random port range used for deployments.\n- Verify that the server has sufficient resources (CPU, memory, disk space) to run multiple Docker containers.\n\n## Best practices:\n\n- Regularly update the action to the latest version to benefit from bug fixes and improvements.\n- Use environment variables for sensitive information instead of hardcoding them in your Dockerfile or start command.\n- Implement proper access controls on your deployment server to ensure security.\n- Regularly clean up unused containers and images to conserve server resources.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhngprojects%2Fpr-deploy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhngprojects%2Fpr-deploy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhngprojects%2Fpr-deploy/lists"}