From 0c0205d9497f4c272b79abf7a0f650c2c789aff4 Mon Sep 17 00:00:00 2001 From: Jon Peck Date: Wed, 5 Jun 2024 23:26:03 -0700 Subject: [PATCH 1/2] Add sample Actions workflow for periodic archiving --- README.md | 55 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) diff --git a/README.md b/README.md index 43e028f..422f36b 100644 --- a/README.md +++ b/README.md @@ -88,6 +88,61 @@ See [CHANGELOG.md](https://github.com/gavinr/github-csv-tools/blob/master/CHANGE This software can be used without download/install by going to [repoio.com](https://repoio.com). +## Running as a GitHub Action + +If you wish to periodically save your issues CSV as a file in your repo, create a YAML file inside `.github/workflows/` + +```yaml +name: Run GitHub CSV Tools + +on: + schedule: + # Runs at 00:00 UTC every Sunday + - cron: '0 0 * * 0' + workflow_dispatch: + +jobs: + run-csv-tools: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install github-csv-tools globally + run: npm install -g github-csv-tools + + - name: Create archive directory + run: mkdir -p archive + + - name: Export issues to CSV + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd archive + githubCsvTools -t "${GITHUB_TOKEN}" -o YOUR_ORGANIZATION -r YOUR_REPO -e -c + + - name: Configure Git + run: | + git config user.email "YOUR_HANDLE@github.com" + git config user.name "YOUR NAME" + + - name: Commit and push CSV file + run: | + cd archive + git add *-issues.csv + git commit -m "Update issues CSV" || true + git pull --no-rebase + git push +``` + +This will run weekly, creating a new CSV file under the "archive" folder (rename if desired), and can also be executed manually in the Actions tab of your repo. + +Be sure to replace the following values: +- YOUR_ORGANIZATION: The User or Organization slug that the repo lives under +- YOUR_REPO: The repository name (slug) +- YOUR_HANDLE: Your GitHub handle +- YOUR NAME: Your name as you with it to appear in the commit history + ## Thanks - [octokit/rest.js](https://octokit.github.io/rest.js/) From 5108e004e032f980668f62acbb6ca17c53dba473 Mon Sep 17 00:00:00 2001 From: Jon Peck Date: Wed, 5 Jun 2024 23:33:22 -0700 Subject: [PATCH 2/2] typo --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 422f36b..3112cdc 100644 --- a/README.md +++ b/README.md @@ -141,7 +141,7 @@ Be sure to replace the following values: - YOUR_ORGANIZATION: The User or Organization slug that the repo lives under - YOUR_REPO: The repository name (slug) - YOUR_HANDLE: Your GitHub handle -- YOUR NAME: Your name as you with it to appear in the commit history +- YOUR NAME: Your name as you wish it to appear in the commit history ## Thanks