Skip to content

Commit 69ef756

Browse files
committed
Update workflows to use new bdip command syntax
1 parent 856ee45 commit 69ef756

File tree

4 files changed

+37
-18
lines changed

4 files changed

+37
-18
lines changed

.github/workflows/check-broken-links.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: pip install --extra-index-url https://maven.sing-group.org/repository/python-snapshots/simple/ bdip-tools
3131

3232
- name: Check for broken links
33-
run: bdip check-broken-links metadata/metadata.json --skip-cloudflare-403 --output report.md
33+
run: bdip check-broken-links -mf metadata/metadata.json --skip-cloudflare-403 --output report.md
3434

3535
- name: Check report file content
3636
id: check_report

.github/workflows/check-software-updates.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ jobs:
3030
run: pip install --extra-index-url https://maven.sing-group.org/repository/python-snapshots/simple/ bdip-tools
3131

3232
- name: Check for software updates
33-
run: bdip check-software-updates --fuzzy-version-match --output report.md --github-token ${{ secrets.GITHUB_TOKEN }} metadata/metadata.json
33+
run: bdip check-software-updates --fuzzy-version-match --output report.md --github-token ${{ secrets.GITHUB_TOKEN }} -mf metadata/metadata.json
3434

3535
- name: Check report file content
3636
id: check_report

.github/workflows/update-copyright-dates.yml

Lines changed: 35 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
permissions:
1414
contents: write
1515
pull-requests: write
16+
env:
17+
BASE_BRANCH: ${{ github.event.repository.default_branch }}
1618

1719
steps:
1820
- name: Checkout repository
@@ -31,31 +33,48 @@ jobs:
3133
git config user.name "github-actions[bot]"
3234
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
3335
36+
- name: Prepare branch
37+
run: |
38+
YEAR=$(date +%Y)
39+
BASE="${BASE_BRANCH:-master}"
40+
BRANCH="maintenance/update-copyright-dates-${YEAR}"
41+
42+
git fetch origin "$BASE"
43+
git switch "$BASE"
44+
git branch -D "$BRANCH" 2>/dev/null || true
45+
46+
PRE_SHA=$(git rev-parse --verify "$BRANCH" 2>/dev/null || echo "none")
47+
echo "YEAR=$YEAR" >> "$GITHUB_ENV"
48+
echo "BASE=$BASE" >> "$GITHUB_ENV"
49+
echo "BRANCH=$BRANCH" >> "$GITHUB_ENV"
50+
echo "PRE_SHA=$PRE_SHA" >> "$GITHUB_ENV"
51+
3452
- name: Update copyright dates
35-
id: update-dates
3653
run: |
37-
set +e
38-
bdip update-copyright-dates --git .
39-
EXIT_CODE=$?
40-
set -e
41-
42-
if [ $EXIT_CODE -eq 0 ]; then
43-
echo "Changes were made and committed to branch"
44-
echo "has_changes=true" >> $GITHUB_OUTPUT
54+
bdip update-copyright-dates \
55+
--dockerfiles-dir . \
56+
--git \
57+
--create-branch \
58+
--push
59+
60+
- name: Detect commit
61+
id: detect
62+
run: |
63+
POST_SHA=$(git rev-parse --verify "$BRANCH" 2>/dev/null || echo "none")
64+
if [ "$POST_SHA" != "none" ] && [ "$POST_SHA" != "$PRE_SHA" ]; then
65+
echo "has_changes=true" >> "$GITHUB_OUTPUT"
4566
else
46-
echo "No copyright updates needed"
47-
echo "has_changes=false" >> $GITHUB_OUTPUT
67+
echo "has_changes=false" >> "$GITHUB_OUTPUT"
4868
fi
4969
5070
- name: Create Pull Request
51-
if: steps.update-dates.outputs.has_changes == 'true'
71+
if: steps.detect.outputs.has_changes == 'true'
5272
env:
53-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5474
run: |
55-
YEAR=$(date +%Y)
5675
gh pr create \
5776
--title "Update copyright dates to $YEAR" \
5877
--body "This PR updates the copyright dates to $YEAR." \
59-
--base master \
60-
--head "maintenance/update-copyright-dates-$YEAR" \
78+
--base "$BASE" \
79+
--head "$BRANCH" \
6180
--label "maintenance"

0 commit comments

Comments
 (0)