Skip to content

Commit 919848f

Browse files
committed
Various improvements and testing
1 parent f4bb322 commit 919848f

File tree

3 files changed

+36
-9
lines changed

3 files changed

+36
-9
lines changed

.github/workflows/check-changelog.yml

+6
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,18 @@ on:
66
# Edited such that we can detect changes to the description
77
types: [opened, synchronize, reopened, edited]
88

9+
permissions:
10+
pull-requests: read
11+
912
jobs:
1013
check:
1114
runs-on: ubuntu-latest
1215
steps:
1316
- uses: actions/checkout@v4
1417
with:
18+
# We need to fetch the parents of the HEAD commit (which is a merge),
19+
# because we need to compare the PR against the base branch
20+
# to check whether it added a changelog
1521
fetch-depth: 2
1622

1723
- name: check changelog

.github/workflows/main.yml

+20-7
Original file line numberDiff line numberDiff line change
@@ -27,33 +27,46 @@ jobs:
2727
# This is needed so we can determine the commits (and therefore PRs)
2828
# where the changelogs have been added
2929
fetch-depth: 0
30+
# By default, the github.token is used and stored in the Git config,
31+
# This would override any authentication provided in the URL,
32+
# which we do later to push to a fork.
33+
# So we need to prevent that from being stored.
34+
persist-credentials: false
3035

3136
- uses: cachix/install-nix-action@v26
3237

3338
- name: Increment version and assemble changelog
3439
run: |
3540
nix-build -A autoVersion
3641
version=$(result/bin/auto-version . ${{ github.event.pull_request.number || '' }})
37-
git config user.name ${{ github.actor }}
38-
git config user.email ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
39-
git commit --all --message "Version $version
42+
echo "version=$version" >> "$GITHUB_ENV"
4043
41-
Automated release"
44+
if [[ -n "$version" ]]; then
45+
git config user.name ${{ github.actor }}
46+
git config user.email ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
47+
git add --all
48+
git commit --message "Version $version
4249
43-
echo "version=$version" >> "$GITHUB_ENV"
50+
Automated release"
51+
fi
4452
env:
4553
GH_TOKEN: ${{ github.token }}
4654

4755
- name: Outputting draft release notes
56+
# If we have a new version at all (it's not an empty string)
57+
# And it's not a push event (so it's a PR),
4858
if: ${{ env.version && github.event_name != 'push' }}
59+
# we just output the draft changelog into the step summary
4960
run: cat changes/released/${{ env.version }}.md > "$GITHUB_STEP_SUMMARY"
5061

5162
- name: Update release branch
52-
#if: ${{ env.version && github.event_name == 'push' }}
63+
# But if this is a push te the main branch,
64+
if: ${{ env.version && github.event_name == 'push' }}
65+
# we push to the release branch.
5366
# This continuously updates the release branch to contain the latest release notes,
5467
# so that one can just merge the release branch into main to do a release.
5568
# A PR to do that is opened regularly with another workflow
56-
run: git push origin HEAD:refs/heads/release -f
69+
run: git push https://${{ secrets.MACHINE_USER_PAT }}@github.com/infinixbot/nixpkgs-check-by-name.git HEAD:refs/heads/release -f
5770

5871

5972
test-update:

.github/workflows/regular-release.yml

+10-2
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,20 @@ jobs:
88
version:
99
runs-on: ubuntu-latest
1010
steps:
11+
- uses: actions/checkout@v4
12+
with:
13+
repository: infinixbot/nixpkgs-check-by-name
14+
ref: release
15+
1116
- name: Create Pull Request
1217
run: |
1318
gh pr create \
1419
--repo ${{ github.repository }} \
15-
--fill \
16-
--head release
20+
--title "$(git log -1 --format=%s HEAD)" \
21+
--body "Automated release PR.
22+
23+
- [x] This change is user-facing
24+
"
1725
env:
1826
# Needed so that CI triggers
1927
GH_TOKEN: ${{ secrets.MACHINE_USER_PAT }}

0 commit comments

Comments
 (0)