diff --git a/.github/workflows/dependabot-scheduler.yml b/.github/workflows/dependabot-scheduler.yml new file mode 100644 index 00000000000..7d9d55a72ea --- /dev/null +++ b/.github/workflows/dependabot-scheduler.yml @@ -0,0 +1,47 @@ +name: Automate Dependency Updates + +on: + push: + branches: + - "dependabot/*" + +jobs: + update-dependencies: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Create a new branch + run: | + git checkout -b update-branch + git push origin update-branch + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.PAT_TOKEN }} + branch: update-branch + title: "Automated Dependency Updates" + body: "Automated dependency updates from GitHub Actions." + base: main + commit-message: "Update dependencies" + + - name: Merge Pull Request + uses: actions/github-script@v6 + with: + script: | + const prNumber = context.payload.pull_request.number; + await github.pulls.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + merge_method: "squash" + }); + github-token: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/disable-dependabot.yml b/.github/workflows/disable-dependabot.yml new file mode 100644 index 00000000000..576eec54016 --- /dev/null +++ b/.github/workflows/disable-dependabot.yml @@ -0,0 +1,22 @@ +name: Disable Dependabot + +on: + schedule: + - cron: '0 14 * * *' # Runs daily at 9 AM EST (14 UTC) + +jobs: + disable: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Disable Dependabot + run: | + mv .github/dependabot.yml .github/dependabot.yml.disabled + git config user.name "GitHub Action" + git config user.email "action@github.com" + git add .github/dependabot.yml.disabled + git commit -S -m "Disable Dependabot updates" + git push + diff --git a/.github/workflows/enable-dependabot.yml b/.github/workflows/enable-dependabot.yml new file mode 100644 index 00000000000..ee08b0f6f19 --- /dev/null +++ b/.github/workflows/enable-dependabot.yml @@ -0,0 +1,22 @@ +name: Enable Dependabot + +on: + schedule: + - cron: '0 2 * * *' # Runs daily at 9 PM EST (2 UTC) + +jobs: + enable: + runs-on: ubuntu-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v3 + + - name: Enable Dependabot + run: | + mv .github/dependabot.yml.disabled .github/dependabot.yml + git config user.name "GitHub Action" + git config user.email "action@github.com" + git add .github/dependabot.yml + git commit -S -m "Enable Dependabot updates" + git push + diff --git a/dependabot-scheduler.yml b/dependabot-scheduler.yml new file mode 100644 index 00000000000..7d9d55a72ea --- /dev/null +++ b/dependabot-scheduler.yml @@ -0,0 +1,47 @@ +name: Automate Dependency Updates + +on: + push: + branches: + - "dependabot/*" + +jobs: + update-dependencies: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v3 + + - name: Set up Git + run: | + git config --global user.name "github-actions[bot]" + git config --global user.email "github-actions[bot]@users.noreply.github.com" + + - name: Create a new branch + run: | + git checkout -b update-branch + git push origin update-branch + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ secrets.PAT_TOKEN }} + branch: update-branch + title: "Automated Dependency Updates" + body: "Automated dependency updates from GitHub Actions." + base: main + commit-message: "Update dependencies" + + - name: Merge Pull Request + uses: actions/github-script@v6 + with: + script: | + const prNumber = context.payload.pull_request.number; + await github.pulls.merge({ + owner: context.repo.owner, + repo: context.repo.repo, + pull_number: prNumber, + merge_method: "squash" + }); + github-token: ${{ secrets.PAT_TOKEN }}