Skip to content

Commit 1bda87c

Browse files
authored
Merge pull request #233 from TechnologyEnhancedLearning/ci-dependabot-setup
chore(dependabot): automated
2 parents 64ccf8c + 8167b1b commit 1bda87c

5 files changed

+100
-102
lines changed

.github/workflows/automerge-dependabot-prs-into-collected-branch.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ jobs:
2323
run: |
2424
echo "actor: ${{ github.actor }}"
2525
echo "pr title: ${{ github.event.pull_request.title }}"
26+
echo "github event_name: ${{ github.event_name }}"
27+
echo "github event_suite conlusion: ${{ github.event.check_suite.conclusion }}"
2628
echo "target branch: ${{ github.event.pull_request.base.ref }}"
2729
echo "source branch: ${{ github.event.pull_request.head.ref }}"
2830
@@ -35,7 +37,8 @@ jobs:
3537
auto-merge:
3638
runs-on: ubuntu-latest
3739
# if dependabot and checks ran
38-
if: (github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch')&& (github.event_name != 'check_suite' || github.event.check_suite.conclusion == 'success')
40+
# if: (github.event_name != 'check_suite' || github.event.check_suite.conclusion == 'success')
41+
# qqqq put back in later if: (github.actor == 'dependabot[bot]' || github.event_name == 'workflow_dispatch')&& (github.event_name != 'check_suite' || github.event.check_suite.conclusion == 'success')
3942
steps:
4043
- name: extract update type
4144
id: extract

.github/workflows/collected-dependabot-staging-to-master.yml

Lines changed: 0 additions & 52 deletions
This file was deleted.
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# qqqq in development
2+
name: Collected Dependabot Promotion From Staging To Master
3+
on:
4+
schedule:
5+
# we want the opposite weeks to staging so we get a week where it occurs in manual testing
6+
- cron: '0 9 8-14 * 1' # Second Monday of month
7+
- cron: '0 9 22-28 * 1' # Fourth Monday of month
8+
workflow_dispatch:
9+
10+
jobs:
11+
promote-to-master:
12+
runs-on: ubuntu-latest
13+
permissions:
14+
contents: write
15+
pull-requests: write
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
with:
20+
fetch-depth: 0
21+
22+
- name: Check for changes
23+
id: changes
24+
run: |
25+
git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging
26+
git fetch origin master:master
27+
28+
if git diff --quiet master Automatic_collected_dependabot_staging; then
29+
echo "has_changes=false" >> $GITHUB_OUTPUT
30+
else
31+
echo "has_changes=true" >> $GITHUB_OUTPUT
32+
fi
33+
34+
- name: Create PR to master
35+
if: steps.changes.outputs.has_changes == 'true'
36+
run: |
37+
if gh pr list --head Automatic_collected_dependabot_staging --base master --json number --jq '.[0].number' | grep -q .; then
38+
echo "PR already exists, skipping creation"
39+
else
40+
gh pr create \
41+
--base master \
42+
--head Automatic_collected_dependabot_staging \
43+
--title "Fortnightly dependabot collected master promotion - $(date +%Y-%m-%d)" \
44+
--body "Automated weekly promotion from staging to master after testing period" \
45+
--auto-merge \
46+
--merge
47+
fi
48+
env:
49+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/collected-dependabot-to-staging.yml

Lines changed: 0 additions & 49 deletions
This file was deleted.
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
# qqqq in development
2+
3+
name: Dependabot Collected Promotion To Staging
4+
# this logic will require branch ruleset checks of running the dev pipeline
5+
on:
6+
schedule:
7+
# Promotion from staging to release should be a week apart so alternating weeks (also live updates dangerous)
8+
- cron: '0 9 1-7 * 1' # First Monday of month
9+
- cron: '0 9 15-21 * 1' # Third Monday of month
10+
workflow_dispatch: # Allow manual trigger
11+
12+
jobs:
13+
promote-to-automatic-collected-dependabot-staging:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: write
17+
pull-requests: write
18+
steps:
19+
- name: Checkout
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Check for changes
25+
id: changes
26+
run: |
27+
git fetch origin Automatic_version_update_dependabot:Automatic_version_update_dependabot
28+
git fetch origin Automatic_collected_dependabot_staging:Automatic_collected_dependabot_staging
29+
30+
if git diff --quiet Automatic_collected_dependabot_staging Automatic_version_update_dependabot; then
31+
echo "has_changes=false" >> $GITHUB_OUTPUT
32+
else
33+
echo "has_changes=true" >> $GITHUB_OUTPUT
34+
fi
35+
36+
- name: Create PR to Automatic_collected_dependabot_staging
37+
if: steps.changes.outputs.has_changes == 'true'
38+
run: |
39+
gh pr create \
40+
--base Automatic_collected_dependabot_staging \
41+
--head Automatic_version_update_dependabot \
42+
--title "Fortnightly dependabot collected to staging - $(date +%Y-%m-%d)" \
43+
--body "Automated Fortnightly promotion of dependency updates from dependabot" \
44+
--auto-merge \
45+
--merge
46+
env:
47+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)