From f4d20ce776b61df2d5248bce7e4d045cfe65fd25 Mon Sep 17 00:00:00 2001 From: Matthew Duck Date: Sun, 19 Jul 2020 06:46:51 +0100 Subject: [PATCH] ci: add workflow to backup issues using gh2md See https://github.com/mattduck/gh2md/issues/11. --- .github/workflows/issues2md.yml | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 .github/workflows/issues2md.yml diff --git a/.github/workflows/issues2md.yml b/.github/workflows/issues2md.yml new file mode 100644 index 0000000..f169001 --- /dev/null +++ b/.github/workflows/issues2md.yml @@ -0,0 +1,37 @@ +# Action to backup issues using gh2md, contributed by +# https://github.com/0ut0fcontrol. +# See https://github.com/mattduck/gh2md/issues/11. +name: Issues2Markdown +on: + push: + schedule: + # every day + - cron: "0 0 * * *" +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@master + with: + persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token + fetch-depth: 0 # otherwise, you will failed to push refs to dest repo + - name: Backup github issues to a markdown file. + run: | + pip install wheel + pip install --user gh2md + $HOME/.local/bin/gh2md $GITHUB_REPOSITORY issues.md --token ${{ secrets.GITHUB_TOKEN }} + git add issues.md + - name: Commit files + run: | + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -m "Backup all issues into issues.md" -a + - name: Extract branch name + shell: bash + run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" + id: extract_branch + - name: Push changes + uses: ad-m/github-push-action@master + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ steps.extract_branch.outputs.branch }}