From 87245d38e7cfded2e7a7b3108ce308f0cdb1a18d Mon Sep 17 00:00:00 2001 From: Abdullah Waheed Date: Thu, 6 Oct 2022 12:36:08 +0500 Subject: [PATCH 1/2] feat: added cron github action to auto update brwoserlist DB periodically --- .github/workflows/update-browserlist.yml | 41 ++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 .github/workflows/update-browserlist.yml diff --git a/.github/workflows/update-browserlist.yml b/.github/workflows/update-browserlist.yml new file mode 100644 index 00000000..be94d10b --- /dev/null +++ b/.github/workflows/update-browserlist.yml @@ -0,0 +1,41 @@ +name: Update Browserlist DB +on: + schedule: + - cron: '0 0 * * 1' + workflow_dispatch: + +jobs: + update-dep: + runs-on: ubuntu-latest + strategy: + matrix: + node: [16] + npm: [8.5.x] + + steps: + - uses: actions/checkout@v2 + - uses: actions/setup-node@v2 + with: + node-version: ${{ matrix.node }} + - run: npm install -g npm@${{ matrix.npm }} + - run: make requirements + + - name: Update dependencies + run: npx browserslist@latest --update-db + + - name: setup testeng-ci + run: | + git clone https://github.com/edx/testeng-ci.git + cd $GITHUB_WORKSPACE/testeng-ci + pip install -r requirements/base.txt + - name: create pull request + id: createpullrequest + env: + GITHUB_TOKEN: ${{ secrets.requirements_bot_github_token }} + GITHUB_USER_EMAIL: ${{ secrets.requirements_bot_github_email }} + run: | + cd $GITHUB_WORKSPACE/testeng-ci + python -m jenkins.pull_request_creator --repo-root=$GITHUB_WORKSPACE \ + --target-branch="master" --base-branch-name="update-browserslist" \ + --commit-message="chore: update browserslist" --pr-title="Update browserslist DB" \ + --pr-body="Updated browserlist DB" --delete-old-pull-requests --output-pr-url-for-github-action From 4a11d4b1765c23e8b1ab5845b190260799b5c16a Mon Sep 17 00:00:00 2001 From: Abdullah Waheed Date: Tue, 20 Dec 2022 22:57:16 +0500 Subject: [PATCH 2/2] refactor: used a shared script to update broswerslist DB, create PR and automerge it --- .github/workflows/update-browserlist.yml | 41 -------------------- .github/workflows/update-browserslist-db.yml | 12 ++++++ 2 files changed, 12 insertions(+), 41 deletions(-) delete mode 100644 .github/workflows/update-browserlist.yml create mode 100644 .github/workflows/update-browserslist-db.yml diff --git a/.github/workflows/update-browserlist.yml b/.github/workflows/update-browserlist.yml deleted file mode 100644 index be94d10b..00000000 --- a/.github/workflows/update-browserlist.yml +++ /dev/null @@ -1,41 +0,0 @@ -name: Update Browserlist DB -on: - schedule: - - cron: '0 0 * * 1' - workflow_dispatch: - -jobs: - update-dep: - runs-on: ubuntu-latest - strategy: - matrix: - node: [16] - npm: [8.5.x] - - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v2 - with: - node-version: ${{ matrix.node }} - - run: npm install -g npm@${{ matrix.npm }} - - run: make requirements - - - name: Update dependencies - run: npx browserslist@latest --update-db - - - name: setup testeng-ci - run: | - git clone https://github.com/edx/testeng-ci.git - cd $GITHUB_WORKSPACE/testeng-ci - pip install -r requirements/base.txt - - name: create pull request - id: createpullrequest - env: - GITHUB_TOKEN: ${{ secrets.requirements_bot_github_token }} - GITHUB_USER_EMAIL: ${{ secrets.requirements_bot_github_email }} - run: | - cd $GITHUB_WORKSPACE/testeng-ci - python -m jenkins.pull_request_creator --repo-root=$GITHUB_WORKSPACE \ - --target-branch="master" --base-branch-name="update-browserslist" \ - --commit-message="chore: update browserslist" --pr-title="Update browserslist DB" \ - --pr-body="Updated browserlist DB" --delete-old-pull-requests --output-pr-url-for-github-action diff --git a/.github/workflows/update-browserslist-db.yml b/.github/workflows/update-browserslist-db.yml new file mode 100644 index 00000000..db4346ef --- /dev/null +++ b/.github/workflows/update-browserslist-db.yml @@ -0,0 +1,12 @@ +name: Update Browserslist DB +on: + schedule: + - cron: '0 0 * * 1' + workflow_dispatch: + +jobs: + update-browserslist: + uses: openedx/.github/.github/workflows/update-browserslist-db.yml@master + + secrets: + requirements_bot_github_token: ${{ secrets.requirements_bot_github_token }}