Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dependabot branch #965

Closed
wants to merge 14 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
permissions:
contents: write
runs-on: ubuntu-latest
if: github.actor == 'dependabot[bot]'
if: github.actor == 'github-actions[bot]'
steps:
- name: Dependabot metadata
id: metadata
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/update_dependabot_branch.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Update dependabot branch
on:
# schedule:
# - cron: "0 5 * * 1-5"
# # allow the GitHub Action to be triggered manually
# workflow_dispatch:
pull_request:
branches: [master]
workflow_dispatch:

jobs:
update_branch:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN_DEPENDABOT_COMMIT }}
- name: make empty commit to dependabot branch
id: empty_dependabot
env:
GITHUB_DEPENDABOT_TOKEN: ${{ secrets.GH_TOKEN_DEPENDABOT_COMMIT }}
GH_TOKEN: ${{ github.token }}
run: |
pr_number=$(gh pr list -S 'author:app/dependabot' --json number -q '.[0].number')
branch_name=$(gh pr view $pr_number --json headRefName -q '.headRefName')
git fetch
git checkout $branch_name
git config --global credential.helper '!f() { sleep 1; echo "username=git token=$GITHUB_DEPENDABOT_TOKEN"; }; f'
git config user.email "[email protected]"
git config user.name "eversC"
git commit --allow-empty -m "Empty commit to force CI/CD"
git remote remove origin
git remote add origin https://[email protected]/ovotech/cloud-key-rotator
git push origin $branch_name
Loading