diff --git a/.github/workflows/twios.yaml b/.github/workflows/twios.yaml new file mode 100644 index 0000000000..9ed209f87a --- /dev/null +++ b/.github/workflows/twios.yaml @@ -0,0 +1,69 @@ +on: + schedule: + # Every Sunday 23:00 + - cron: '0 23 * * 0' + pull_request: + types: [unlabeled] + issue_comment: + types: [edited] + workflow_dispatch: + +env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TWIOS_BRANCH: "master" + TWIOS_PR_REF: ${{ github.event.pull_request.head.ref }} + +permissions: + pull-requests: write + +jobs: + create_twios: + runs-on: ubuntu-latest + if: ${{!github.event.pull_request.body && github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'}} + steps: + - uses: actions/checkout@v3 + - uses: volta-cli/action@d253558a6e356722728a10e9a469190de21a83ef # v4 + with: + registry-url: "https://registry.npmjs.org" + - name: Configure local git + run: | + git config --global user.email "twios@twios_test_dev.com" + git config --global user.name "TWIOS Dev" + - name: Generate Comment + run: | + GITHUB_PERSONAL_TOKEN=$GITHUB_TOKEN yarn this-week comment > comment.txt + - name: Generate TWIOS + run: GITHUB_PERSONAL_TOKEN=$GITHUB_TOKEN yarn this-week + - name: Push new TWIOS + run: | + FORMATTED_DATE="$(date +"%Y-%m-%d")" + BRANCH_NAME="twios-$FORMATTED_DATE" + git fetch origin $TWIOS_BRANCH + git checkout -b $BRANCH_NAME + git add **/*.md **/*.json && git commit -m "$BRANCH_NAME" + git push --set-upstream origin $BRANCH_NAME + gh pr create --base main --head $BRANCH_NAME --title "TWIOS $FORMATTED_DATE" --body-file comment.txt + + edit_twios: + runs-on: ubuntu-latest + if: ${{github.event.pull_request.body && contains(github.event.pull_request.head.ref, 'twios')}} + steps: + - uses: actions/checkout@v3 + - uses: volta-cli/action@d253558a6e356722728a10e9a469190de21a83ef # v4 + with: + registry-url: "https://registry.npmjs.org" + - name: Configure local git + run: | + git config --global user.email "twios@twios_test_dev.com" + git config --global user.name "TWIOS Dev" + - name: Read PR comment body + run: | + GITHUB_PERSONAL_TOKEN=$GITHUB_TOKEN yarn this-week comment --comment="${{ github.event.pull_request.body }}" + - name: Generate TWIOS + run: GITHUB_PERSONAL_TOKEN=$GITHUB_TOKEN yarn this-week -edit + - name: Push updated TWIOS + run: | + git fetch origin $TWIOS_PR_REF + git checkout $TWIOS_PR_REF + git add **/*.md **/*.json && git commit -m "Edited $TWIOS_PR_REF" + git push diff --git a/bin/this-week-in-open-source b/bin/this-week-in-open-source index 770901dcf1..02b21561f1 100755 Binary files a/bin/this-week-in-open-source and b/bin/this-week-in-open-source differ diff --git a/config/this-week-in-open-source.config.json b/config/this-week-in-open-source.config.json index 9a36e342aa..b8e23037f5 100644 --- a/config/this-week-in-open-source.config.json +++ b/config/this-week-in-open-source.config.json @@ -1,4 +1,5 @@ { + "output_path": "src/twios/", "exclude_closed_not_merged": true, "users": [ "marcoow", @@ -66,7 +67,7 @@ "emberjs/core-notes", "candunaj/ember-in-viewport", "oscard0m/openapi", - "mansona/ember-inline-svg" + "mansona/ember-inline-svg" ], "labels": [ {