Issues2Markdown #1454
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Action to backup issues using gh2md, contributed by | |
# https://github.com/0ut0fcontrol. | |
# See https://github.com/mattduck/gh2md/issues/11. | |
name: Issues2Markdown | |
on: | |
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: | | |
pip3 install --user --upgrade setuptools | |
pip3 install --user gh2md | |
$HOME/.local/bin/gh2md $GITHUB_REPOSITORY issues.md --idempotent | |
git add issues.md | |
env: | |
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Commit files | |
run: | | |
git config --local user.email "action@github.com" | |
git config --local user.name "GitHub Action" | |
git diff --quiet && git diff --staged --quiet || git commit -am "docs: backup all issues into issues.md" | |
- 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 }} |