{"id":20636352,"url":"https://github.com/amraneze/push-to-protected-branch","last_synced_at":"2025-04-15T21:34:42.229Z","repository":{"id":65157416,"uuid":"420057506","full_name":"Amraneze/push-to-protected-branch","owner":"Amraneze","description":"Github action to add files, commit and push them to a protected branch in a Github repository.","archived":false,"fork":false,"pushed_at":"2021-12-01T13:27:03.000Z","size":70,"stargazers_count":4,"open_issues_count":2,"forks_count":1,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-17T09:54:36.657Z","etag":null,"topics":["github","github-actions","protected-branches-true","tag"],"latest_commit_sha":null,"homepage":"","language":"Python","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/Amraneze.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}},"created_at":"2021-10-22T10:30:12.000Z","updated_at":"2024-08-08T13:24:36.000Z","dependencies_parsed_at":"2023-01-13T15:43:09.057Z","dependency_job_id":null,"html_url":"https://github.com/Amraneze/push-to-protected-branch","commit_stats":{"total_commits":15,"total_committers":4,"mean_commits":3.75,"dds":0.4666666666666667,"last_synced_commit":"e7629adea078d49078d480b7e477bc99014c144d"},"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amraneze%2Fpush-to-protected-branch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amraneze%2Fpush-to-protected-branch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amraneze%2Fpush-to-protected-branch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Amraneze%2Fpush-to-protected-branch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Amraneze","download_url":"https://codeload.github.com/Amraneze/push-to-protected-branch/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224930174,"owners_count":17393951,"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":["github","github-actions","protected-branches-true","tag"],"created_at":"2024-11-16T15:10:31.297Z","updated_at":"2024-11-16T15:10:31.845Z","avatar_url":"https://github.com/Amraneze.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Push to a protected branch in Github\n\nGithub action to add files, commit and push them to a protected branch in a Github repository.\n\n## Inputs\n\n`* mandatory`\n\n| Name | Default | Description | Example |\n| ------------- | ------------- | ------------- | ------------- |\n| `repository`* | | Your github respository's name | `push-to-protected-branch`\n| `create_tag` | `false` | If you want to create a tag version | `true`\n| `branch_name` | `main` | Your repository protected branch that you want to push to it | `master`\n| `tag_version` | | The version that should be used to tag the release | `0.0.1`\n| `github_token`* | | The Github PAT to be use on requests to the github api | `${{ secrets.GITHUB_TOKEN }}`\n| `commit_message`* | | The message to be used as the commit message | `ci: build version v0.0.1 - [actions skip]`\n| `files_to_commit`* | | Comma-separated list of files path. | `package.json,build.gradle`\n\n\u003ePS: Adding `[actions skip]` will not trigger an automatic build\n\n## Example\n\nAn example of how to use this github action:\n\n### Without creating a tag version\n\n```yaml\nname: Build\n\non:\n  workflow_dispatch:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    name: Build \u0026 tag version\n    steps:\n      ...\n      - name: Bump project's version\n        id: version\n        run: |\n          PACKAGE_VERSION=$(node -p -e \"require('./package.json').version\")\n          echo ::set-output name=TAG::${PACKAGE_VERSION}\n      - name: Push files and tag\n        uses: Amraneze/push-to-protected-branch@latest\n        with:\n          repository: ${{ github.repository }}\n          branch_name: ${{ github.ref_name }}\n          github_token: ${{ secrets.TOKEN }}\n          commit_message: 'ci: build version v${{ steps.version.outputs.TAG }}'\n          files_to_commit: 'package.json,CHANGELOG.md,README.md'\n\n```\n\n### With a tag version\n\n```yaml\nname: Build\n\non:\n  workflow_dispatch:\n  push:\n    branches:\n      - main\n  pull_request:\n    branches:\n      - main\n\njobs:\n  build:\n    runs-on: ubuntu-latest\n    name: Build \u0026 tag version\n    steps:\n      ...\n      - name: Bump project's version\n        id: version\n        run: |\n          PACKAGE_VERSION=$(node -p -e \"require('./package.json').version\")\n          echo ::set-output name=TAG::${PACKAGE_VERSION}\n      - name: Push files and tag\n        uses: Amraneze/push-to-protected-branch@latest\n        with:\n          repository: ${{ github.repository }}\n          create_tag: true\n          branch_name: ${{ github.ref_name }}\n          tag_version: ${{ steps.version.outputs.TAG }}\n          github_token: ${{ secrets.TOKEN }}\n          commit_message: 'ci: build version v${{ steps.version.outputs.TAG }}'\n          files_to_commit: 'package.json,CHANGELOG.md,README.md'\n\n```\n\n### With Github App's access token\n\n```yaml\njobs:\n  build:\n    runs-on: ubuntu-latest\n    name: Build \u0026 tag version\n    steps:\n      ...\n      - name: Bump project's version\n        id: version\n        run: |\n          PACKAGE_VERSION=$(node -p -e \"require('./package.json').version\")\n          echo ::set-output name=TAG::${PACKAGE_VERSION}\n      - name: Generate token for GitHub App\n        id: generate-access-token\n        uses: getsentry/action-github-app-token@@v1.0.6\n        with:\n          app_id: ${{ secrets.GITHUB_APP_ID }}\n          private_key: ${{ secrets.GITHUB_APP_PRIVATE_KEY }}\n      - name: Push files and tag\n        uses: Amraneze/push-to-protected-branch@latest\n        with:\n          repository: ${{ github.repository }}\n          branch_name: ${{ github.ref_name }}\n          github_token: ${{ steps.generate-access-token.outputs.token }}\n          commit_message: 'ci: build version v${{ steps.version.outputs.TAG }}'\n          files_to_commit: 'package.json,CHANGELOG.md,README.md'\n\n```\n\n## Requirements\nYou should install [Peotry](https://python-poetry.org) and run this following command to add git hooks:\n\n```\npeotry install\npre-commit install\n```\n\n## Building\nFor building the project you can use peotry cli to do so, for that you can run this command `peotry build`\n\n## Contributions\nWe would :heart: contributions to improve this action. Please feel free to do so.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famraneze%2Fpush-to-protected-branch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famraneze%2Fpush-to-protected-branch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famraneze%2Fpush-to-protected-branch/lists"}