{"id":13682625,"url":"https://github.com/shakacode/react-webpack-rails-tutorial","last_synced_at":"2025-05-14T05:10:39.900Z","repository":{"id":20803442,"uuid":"24088847","full_name":"shakacode/react-webpack-rails-tutorial","owner":"shakacode","description":"Example of integration of Rails, react, redux, using the react_on_rails gem, webpack, enabling the es7 and jsx transpilers, and node integration. And React Native! Live Demo:","archived":false,"fork":false,"pushed_at":"2025-04-29T20:18:12.000Z","size":5993,"stargazers_count":1722,"open_issues_count":6,"forks_count":385,"subscribers_count":57,"default_branch":"master","last_synced_at":"2025-04-29T20:32:38.208Z","etag":null,"topics":["rails-gem","rails-react","rails-server","react","shakacode","webpack","webpack-server","webpack2"],"latest_commit_sha":null,"homepage":"http://www.reactrails.com","language":"Ruby","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/shakacode.png","metadata":{"files":{"readme":".github/readme.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.md","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,"zenodo":null}},"created_at":"2014-09-16T06:54:32.000Z","updated_at":"2025-04-26T15:37:30.000Z","dependencies_parsed_at":"2023-10-29T17:28:51.522Z","dependency_job_id":"ceadfe32-3258-4d85-92a6-a7d18f66f092","html_url":"https://github.com/shakacode/react-webpack-rails-tutorial","commit_stats":{"total_commits":590,"total_committers":61,"mean_commits":9.672131147540984,"dds":0.5745762711864406,"last_synced_commit":"3e1f7226acddffc82b102cb1799f0dc1148a79c0"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shakacode%2Freact-webpack-rails-tutorial","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shakacode%2Freact-webpack-rails-tutorial/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shakacode%2Freact-webpack-rails-tutorial/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/shakacode%2Freact-webpack-rails-tutorial/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/shakacode","download_url":"https://codeload.github.com/shakacode/react-webpack-rails-tutorial/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254076850,"owners_count":22010611,"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":["rails-gem","rails-react","rails-server","react","shakacode","webpack","webpack-server","webpack2"],"created_at":"2024-08-02T13:01:49.904Z","updated_at":"2025-05-14T05:10:39.818Z","avatar_url":"https://github.com/shakacode.png","language":"Ruby","funding_links":[],"categories":["JavaScript","Happy Exploring 🤘","Ruby on Rails Resources"],"sub_categories":["Chrome Extensions"],"readme":"# Developing and Testing Github Actions\n\nTesting Github Actions on an existing repository is tricky.\n                                                                               \nThe main issue boils down to the fact that Github Actions uses the workflow files in the branch where the event originates. This is fine for push events, but it becomes a problem when you want to test workflows that are triggered by comments on a pull request.\n\nHere's a summary of the behavior:\n  \nBehavior of push and pull_request Events\n\t1.\tPush on a Branch:\n\t•\tWhen you push changes to a branch (e.g., feature-branch), GitHub Actions uses the workflow files in that same branch.\n\t•\tThis is why changes to workflows work seamlessly when testing with push events.\n\t2.\tPull Request Events:\n\t•\tFor pull_request events (e.g., a PR from feature-branch into master), GitHub Actions will always use the workflow files from the target branch (e.g., master), not the source branch (e.g., feature-branch).\n\t•\tThis is a security feature to prevent someone from introducing malicious code in a PR that modifies the workflow files themselves.\n\nImpact on Comment-Triggered Workflows\n\nWhen you want to trigger workflows via comments (issue_comment) in a pull request:\n\t•\tThe workflow code used will always come from the master branch (or the default branch), regardless of the branch where the PR originates.\n\t•\tThis means the PR’s changes to the workflow won’t be used, and the action invoked by the comment will also use code from master.\n\nWorkarounds to Test Comment-Triggered Workflows\n\nIf you want to test workflows in a way that uses the changes in the pull request, here are your options:\n\n1. Use Push Events for Testing\n\t•\tTest your changes on a branch with push triggers.\n\t•\tUse workflow_dispatch to simulate the events you need (like invoking actions via comments).\n\nThis allows you to confirm that your changes to the workflow file or actions behave as expected before merging into master.\n\n2. Merge the Workflow to master Temporarily\n\nIf you absolutely need the workflow to run as part of a pull_request event:\n\t1.\tMerge your workflow changes into master temporarily.\n\t2.\tOpen a PR to test your comment-triggered workflows.\n\t3.\tRevert the changes in master if necessary.\n\nThis ensures the workflow changes are active in master while still testing with the pull_request context.\n\n3. Add Logic to Detect the Source Branch\n\nUse github.event.pull_request.head.ref to add custom logic in your workflow that behaves differently based on the source branch.\n\t•\tExample:\n\njobs:\n  test-pr:\n    runs-on: ubuntu-latest\n    if: ${{ github.event.pull_request.head.ref == 'feature-branch' }}\n    steps:\n      - name: Checkout Code\n        uses: actions/checkout@v3\n\n      - name: Debug\n        run: echo \"Testing workflow changes in feature-branch\"\n\nHowever, this still requires the workflow itself to exist in master.\n\n4. Use a Fork or a Temporary Repo\n\nCreate a temporary repository or a fork to test workflows in isolation:\n\t•\tPush your workflow changes to master in the test repository.\n\t•\tOpen a PR in the fork to test how workflows behave with issue_comment events and PR contexts.\n\nOnce confirmed, you can replicate the changes in your main repository.\n\n6. Alternative Approach: Split Workflows\n\nIf your workflow includes comment-based triggers (issue_comment), consider splitting your workflows:\n\t•\tA base workflow in master that handles triggering.\n\t•\tA test-specific workflow for validating changes on a branch.\n\nFor example:\n\t1.\tThe base workflow triggers when a comment like /run-tests is added.\n\t2.\tThe test-specific workflow runs in response to the base workflow but uses the branch’s code.\n\nSummary\n\t•\tFor push events: The branch-specific workflow is used, so testing changes is easy.\n\t•\tFor pull_request and issue_comment events: GitHub always uses workflows from the master branch, and there’s no direct way to bypass this.\n\nTo test comment-triggered workflows:\n\t1.\tUse push or workflow_dispatch to validate changes.\n\t2.\tMerge workflow changes temporarily into master to test with pull_request events.\n\t3.\tUse tools like act for local simulation.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshakacode%2Freact-webpack-rails-tutorial","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fshakacode%2Freact-webpack-rails-tutorial","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fshakacode%2Freact-webpack-rails-tutorial/lists"}