{"id":19468283,"url":"https://github.com/skrepr/github-backup-action","last_synced_at":"2025-04-25T11:32:25.941Z","repository":{"id":60177518,"uuid":"500738198","full_name":"skrepr/github-backup-action","owner":"skrepr","description":"Github Action to backup a Github Organization","archived":false,"fork":false,"pushed_at":"2024-03-16T14:38:42.000Z","size":1262,"stargazers_count":10,"open_issues_count":11,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-10-14T12:34:14.248Z","etag":null,"topics":["action","backup","github","typescript","utility"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/skrepr.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":".github/CODEOWNERS","security":".github/SECURITY.md","support":null,"governance":null}},"created_at":"2022-06-07T07:39:17.000Z","updated_at":"2023-08-15T09:53:04.000Z","dependencies_parsed_at":"2023-02-17T07:15:32.659Z","dependency_job_id":"3a1e3b0a-99da-44f6-af2a-dd261a515246","html_url":"https://github.com/skrepr/github-backup-action","commit_stats":{"total_commits":31,"total_committers":3,"mean_commits":"10.333333333333334","dds":0.4516129032258065,"last_synced_commit":"c43f2342d1d5aef6fca90698cabfd2c0f390a429"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skrepr%2Fgithub-backup-action","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skrepr%2Fgithub-backup-action/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skrepr%2Fgithub-backup-action/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/skrepr%2Fgithub-backup-action/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/skrepr","download_url":"https://codeload.github.com/skrepr/github-backup-action/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223999798,"owners_count":17238974,"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":["action","backup","github","typescript","utility"],"created_at":"2024-11-10T18:40:27.158Z","updated_at":"2024-11-10T18:40:27.740Z","avatar_url":"https://github.com/skrepr.png","language":"TypeScript","readme":"\u003ca href=\"https://skrepr.com/\"\u003e\n  \u003cp align=\"center\"\u003e\n    \u003cimg width=\"200\" height=\"100\" src=\"https://cdn.skrepr.com/logo/skrepr_liggend.svg\" alt=\"skrepr_logo\" alt=\"skrepr\" /\u003e\n  \u003c/p\u003e\n\u003c/a\u003e\n\u003ch1 align=\"center\"\u003eGithub Backup Action\u003c/h1\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://github.com/skrepr/github-backup-action/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/release/skrepr/github-backup-action.svg\" alt=\"Releases\"/\u003e\u003c/a\u003e\u003ca\u003e \u003c/a\u003e\n  \u003ca href=\"https://github.com/skrepr/github-backup-action/blob/main/LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/github/license/skrepr/github-backup-action.svg\" alt=\"LICENSE\"/\u003e\u003c/a\u003e\u003ca\u003e \u003c/a\u003e\n  \u003ca href=\"https://github.com/skrepr/github-backup-action/issues\"\u003e\u003cimg src=\"https://img.shields.io/github/issues/skrepr/github-backup-action.svg\" alt=\"Issues\"/\u003e\u003c/a\u003e\u003ca\u003e \u003c/a\u003e\n  \u003ca href=\"https://github.com/skrepr/github-backup-action/pulls\"\u003e\u003cimg src=\"https://img.shields.io/github/issues-pr/skrepr/github-backup-action.svg\" alt=\"PR\"/\u003e\u003c/a\u003e\u003ca\u003e \u003c/a\u003e\n  \u003ca href=\"https://github.com/skrepr/github-backup-action/commits\"\u003e\u003cimg src=\"https://img.shields.io/github/commit-activity/m/skrepr/github-backup-action\" alt=\"Commits\"/\u003e\u003c/a\u003e\u003ca\u003e \u003c/a\u003e\n  \u003ca href=\"https://github.com/skrepr/github-backup-action/stars\"\u003e\u003cimg src=\"https://img.shields.io/github/stars/skrepr/github-backup-action.svg\" alt=\"Stars\"/\u003e\u003c/a\u003e\u003ca\u003e \u003c/a\u003e\n  \u003ca href=\"https://github.com/skrepr/github-backup-action/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/forks/skrepr/github-backup-action.svg\" alt=\"Forks\"/\u003e\u003c/a\u003e\u003ca\u003e \u003c/a\u003e\n\u003c/div\u003e\n\n# About\n\nThis GitHub Action allows you to backup and archive a organization repository to an S3 Bucket with the help of the [GitHub Organization migrations API](https://docs.github.com/en/rest/migrations/orgs#start-an-organization-migration)\n\n# Requirements\n\nThe Migrations API is only available to authenticated organization owners. For more information, see \"Roles in an organization\" and \"Other authentication methods.\"\n\nEnsure that you have owner permissions on the source organization's repositories.\n[Generate an access token](https://docs.github.com/en/enterprise-server@3.6/articles/creating-an-access-token-for-command-line-use) with the `repo` and `admin:org` scopes on GitHub.com.\nTo minimize downtime, make a list of repositories you want to export from the source instance. You can add multiple repositories to an export at once using a text file that lists the URL of each repository on a separate line.\n\n# Commands\n\nTo build the project: `npm run build`\nTo watch project during developement: `npm run watch`\nTo run the script: `node dist/main.ts`\nList all repos: `curl \"https://api.github.com/orgs/skrepr/repos\" \\\n     -u 'username:\u003cpersonal access token\u003e'`\n# Github Action example config\n\n## Create archive\n\n```yaml\nname: Backup repositories\n\non:\n  schedule:\n    - cron: '0 1 * * 0'  # At 01:00 on Sunday\n\njobs:\n  backup:\n    name: Create archive\n    runs-on: ubuntu-latest\n    timeout-minutes: 30\n\n    steps:\n    - name: Github Migrations Backup\n      uses: skrepr/github-backup-action@2.0.0\n      with:\n        github-organization: \"your-organization-here\"\n        github-apikey: ${}\n        aws-bucket-name: \"your-bucket-here\"\n        aws-bucket-region: \"your-bucket-region-here\"\n        aws-access-key: ${AWS_ACCESS_KEY} # Github Secret is advised\n        aws-secret-key: ${AWS_SECRET_KEY} # Github Secret is advised\n\n    # Save migration.data.id as an artifact at the end of the first run\n    - name: Archive Data\n      uses: actions/upload-artifact@v2\n      with:\n        name: migration-data\n        path: migration_response.json\n```\n\n## Download archive\n\n```yaml\nname: Download archive\n\non:\n  schedule:\n    - cron: '0 3 * * 0'  # At 03:00 on Sunday\n\njobs:\n  backup:\n    name: Download archive\n    runs-on: ubuntu-latest\n    timeout-minutes: 30\n\n    steps:\n\n    # Download the migration.data.id as an artifact at the beginning of the second run\n    - name: Archive Data\n      uses: actions/download-artifact@v2\n      with:\n        name: migration-data\n        path: migration_response.json\n\n    - name: Github Migrations Backup\n      uses: skrepr/github-backup-action@2.0.0\n      with:\n        download-migration: true\n        github-organization: \"your-organization-here\"\n        github-apikey: ${}\n        aws-bucket-name: \"your-bucket-here\"\n        aws-bucket-region: \"your-bucket-region-here\"\n        aws-access-key: ${AWS_ACCESS_KEY} # Github Secret is advised\n        aws-secret-key: ${AWS_SECRET_KEY} # Github Secret is advised\n```\n\n# AWS policy for S3 bucket user\n\n```json\n{\n    \"Version\": \"2012-10-17\",\n    \"Statement\": [\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:ListBucket\"\n            ],\n            \"Resource\": [\n                \"arn:aws:s3:::your-bucket-here\"\n            ]\n        },\n        {\n            \"Effect\": \"Allow\",\n            \"Action\": [\n                \"s3:PutObject\",\n                \"s3:GetObject\"\n            ],\n            \"Resource\": [\n                \"arn:aws:s3:::your-bucket-here/*\"\n            ]\n        }\n    ]\n}\n```\n\n# Recovering your repositories from the archive\n\nGithub migrations only archives your .git from every repository.\n\nTo recover your code from the archive:\n\n1. Place all the repo.git files in a .git folder.\n2. Execute the command `git init`\n3. After Git has reinitialized the project, execute `git reset --hard HEAD`\n\n\n## License\n\nMIT / BSD\n\n## Author Information\n\nThis Github Action was created in 2022 by [Jeroen van der Meulen](https://github.com/jeroenvandermeulen), commisioned by [Skrepr](https://skrepr.com)\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskrepr%2Fgithub-backup-action","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fskrepr%2Fgithub-backup-action","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fskrepr%2Fgithub-backup-action/lists"}