From af97e265705e3ef793a9fee7593cf51f8e5c65b5 Mon Sep 17 00:00:00 2001 From: thefourCraft Date: Mon, 11 Sep 2023 16:29:09 +0300 Subject: [PATCH] Thefourcraft patch 1 (#7) * Rename hello-world.md to intro.md * update pack and fix outdated * temp remove yarn * update github things * create workflows for testing auto pr for pages --- .github/ISSUE_TEMPLATE/new_docusaurus_page.md | 21 ++++++++ .github/workflows/create_docusaurus_page.yml | 48 +++++++++++++++++++ .github/workflows/stale-bot..yml | 22 +++++++++ .gitignore | 3 ++ 4 files changed, 94 insertions(+) create mode 100644 .github/ISSUE_TEMPLATE/new_docusaurus_page.md create mode 100644 .github/workflows/create_docusaurus_page.yml create mode 100644 .github/workflows/stale-bot..yml diff --git a/.github/ISSUE_TEMPLATE/new_docusaurus_page.md b/.github/ISSUE_TEMPLATE/new_docusaurus_page.md new file mode 100644 index 0000000..214754b --- /dev/null +++ b/.github/ISSUE_TEMPLATE/new_docusaurus_page.md @@ -0,0 +1,21 @@ +--- +name: New Docusaurus Page +about: Create a new Docusaurus page. +labels: new-page +--- + +## Page Title + +Enter the title of the page. + +## Page Description + +Enter the description for the page. + +## Sidebar Position + +Enter the sidebar position for the page. + +## Page Content + +Enter the content of the page. diff --git a/.github/workflows/create_docusaurus_page.yml b/.github/workflows/create_docusaurus_page.yml new file mode 100644 index 0000000..669cc8e --- /dev/null +++ b/.github/workflows/create_docusaurus_page.yml @@ -0,0 +1,48 @@ +name: Create Docusaurus Page from Issue + +on: + issues: + types: [opened, labeled] + +jobs: + create-docusaurus-page: + runs-on: ubuntu-latest + if: github.event.label.name == 'new-page' + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Create Branch + run: | + ISSUE_NUMBER=${{ github.event.issue.number }} + BRANCH_NAME="new-page-${ISSUE_NUMBER}" + git checkout -b $BRANCH_NAME + git push origin $BRANCH_NAME + + - name: Create Docusaurus File + run: | + ISSUE_NUMBER=${{ github.event.issue.number }} + ISSUE_BODY="${{ github.event.issue.body }}" + TITLE=$(echo "$ISSUE_BODY" | grep -oP '## Page Title\s*\K.*') + DESCRIPTION=$(echo "$ISSUE_BODY" | grep -oP '## Page Description\s*\K.*') + SIDEBAR_POSITION=$(echo "$ISSUE_BODY" | grep -oP '## Sidebar Position\s*\K.*') + CONTENT=$(echo "$ISSUE_BODY" | sed -n '/## Page Content/,//p' | tail -n +2) + FILENAME="./docs/new-page-${ISSUE_NUMBER}.md" + + echo "---" > $FILENAME + echo "title: $TITLE" >> $FILENAME + echo "description: $DESCRIPTION" >> $FILENAME + echo "sidebar_position: $SIDEBAR_POSITION" >> $FILENAME + echo "---" >> $FILENAME + echo "$CONTENT" >> $FILENAME + + git add $FILENAME + git commit -m "Create new Docusaurus page from issue $ISSUE_NUMBER" + git push origin $BRANCH_NAME + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + title: "New Docusaurus Page from Issue ${{ github.event.issue.number }}" + branch: "new-page-${{ github.event.issue.number }}" + base: "main" diff --git a/.github/workflows/stale-bot..yml b/.github/workflows/stale-bot..yml new file mode 100644 index 0000000..b52df80 --- /dev/null +++ b/.github/workflows/stale-bot..yml @@ -0,0 +1,22 @@ +name: 'Automatically close stale issues and PRs' +on: + workflow_dispatch: + schedule: + - cron: '0 */6 * * *' +#Run every 6 hours + +jobs: + stale: + runs-on: ubuntu-latest + steps: + - uses: actions/stale@v7 + with: + stale-issue-message: 'We are clearing up our old issues and your ticket has been open for 3 months with no activity. Remove stale label or comment or this will be closed in 2 days.' + close-issue-message: 'This issue was closed because it has been stalled for 30 days with no activity.' + days-before-stale: 90 + days-before-close: 30 + days-before-pr-stale: 999999999 + days-before-pr-close: 1 + exempt-issue-labels: 'News,Medium,High,discussion,bug,doc,feature-request' + exempt-issue-assignees: 'thefourcraft' + operations-per-run: 200 \ No newline at end of file diff --git a/.gitignore b/.gitignore index b2d6de3..711f862 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,6 @@ npm-debug.log* yarn-debug.log* yarn-error.log* + +# Remove Yarn +.yarn