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

Autoupdate coredns can automerge its own PRs #26

Merged
merged 1 commit into from
Dec 9, 2024
Merged
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
23 changes: 23 additions & 0 deletions .github/workflows/automerge-cdkbot-prs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Auto-merge cdkbot PRs

on: pull_request

permissions:
contents: write
pull-requests: write

jobs:
cdkbot:
runs-on: ubuntu-latest
if: ${{ github.actor == 'cdkbot' }}
steps:
- name: Approve a PR
run: gh pr review --approve "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
- name: Enable auto-merge for bot PRs
run: gh pr merge --auto --rebase "$PR_URL"
env:
PR_URL: ${{github.event.pull_request.html_url}}
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
9 changes: 9 additions & 0 deletions .github/workflows/update_version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,14 @@ on:
branches:
- main

permissions:
contents: read

jobs:
generator:
permissions:
contents: write # for peter-evans/create-pull-request to create branch
pull-requests: write # for peter-evans/create-pull-request to create a PR
name: Generate Step for new CoreDNS versions
runs-on: ubuntu-24.04
steps:
Expand All @@ -18,6 +24,7 @@ jobs:
with:
path: coredns-rock
ref: ${{ github.head_ref || 'main' }}
ssh-key: ${{ secrets.BOT_SSH_KEY }}

- name: Checkout coredns repository
uses: actions/checkout@v4
Expand All @@ -44,5 +51,7 @@ jobs:
body: Update CoreDNS versions with ${{ join(fromJSON(steps.emit-rockcraft.outputs.tags), ', ') }}
path: coredns-rock
branch: autoupdate/sync/coredns
labels: |
automerge
delete-branch: true
base: main
37 changes: 0 additions & 37 deletions 1.12.0/rockcraft.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,4 @@ update-component: install-tools clone-CoreDNS
# Target to remove the temporary directory
clean:
@rm -rf $(COREDNS_GIT_DIR)
@echo "Temporary directory removed: $(COREDNS_GIT_DIR)"
@echo "Temporary directory removed: $(COREDNS_GIT_DIR)"
13 changes: 7 additions & 6 deletions build/craft_release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ RO_SCRIPT_DIR="$( dirname "${BASH_SOURCE[0]}")"
RO_REPO_DIR=$(dirname ${RO_SCRIPT_DIR})
RO_VERSIONS=${RO_SCRIPT_DIR}/../versions.txt

function usage() {
function check_environment() {
if [[ -z ${COREDNS_GIT_DIR+x} ]]; then
echo "COREDNS_GIT_DIR is not set" > /dev/stderr
echo " Clone with 'git clone --bare --filter=blob:none --no-checkout https://github.com/coredns/coredns.git /tmp/coredns.git'" > /dev/stderr
echo " Re-run with 'COREDNS_GIT_DIR=/tmp/coredns.git $0'" > /dev/stderr
echo "COREDNS_GIT_DIR is not set" >&2
echo " Clone with 'git clone --bare --filter=blob:none --no-checkout https://github.com/coredns/coredns.git /tmp/coredns.git'" >&2
echo " Re-run with 'COREDNS_GIT_DIR=/tmp/coredns.git $0'" >&2
exit 1
fi
}
Expand All @@ -20,7 +20,7 @@ function usage() {
function check_dependencies(){
for cmd in yq jq git envsubst; do
if ! command -v $cmd &> /dev/null; then
echo "$cmd could not be found" > /dev/stderr
echo "$cmd could not be found" >&2
exit 1
fi
done
Expand All @@ -35,6 +35,7 @@ function create_rockcrafts(){

rm -rf ${RO_VERSIONS}
for rockcraft in $(find ${RO_REPO_DIR} -name 'rockcraft.yaml'); do
# output is piped through echo to work through yq confinement
echo $(yq '.version' $rockcraft) >> ${RO_VERSIONS}
done
current_releases=( $(sort -V ${RO_VERSIONS}) )
Expand Down Expand Up @@ -74,7 +75,7 @@ function create_rockcrafts(){


function main() {
usage
check_environment
check_dependencies
create_rockcrafts
}
Expand Down
Loading