Skip to content

Commit 53a016f

Browse files
committed
Various improvements and testing
1 parent f4bb322 commit 53a016f

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
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

+14-3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,11 @@ 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

@@ -36,7 +41,8 @@ jobs:
3641
version=$(result/bin/auto-version . ${{ github.event.pull_request.number || '' }})
3742
git config user.name ${{ github.actor }}
3843
git config user.email ${{ github.actor_id }}+${{ github.actor }}@users.noreply.github.com
39-
git commit --all --message "Version $version
44+
git add --all
45+
git commit --message "Version $version
4046
4147
Automated release"
4248
@@ -45,15 +51,20 @@ jobs:
4551
GH_TOKEN: ${{ github.token }}
4652

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

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

5869

5970
test-update:

.github/workflows/regular-release.yml

+11-2
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,26 @@ on:
33
workflow_dispatch: # Allows triggering manually
44
schedule:
55
- cron: '47 14 * * 2' # runs every Tuesday at 14:47 UTC (chosen somewhat randomly)
6+
pull_request:
7+
branches:
8+
main
69

710
jobs:
811
version:
912
runs-on: ubuntu-latest
1013
steps:
14+
- uses: actions/checkout@v4
15+
with:
16+
repository: infinixbot/nixpkgs-check-by-name
17+
ref: release
18+
1119
- name: Create Pull Request
1220
run: |
21+
subject=$(git log -1 --format=%s HEAD)
1322
gh pr create \
1423
--repo ${{ github.repository }} \
15-
--fill \
16-
--head release
24+
--title "$(head -1 <<< "$subject")" \
25+
--body "$(tail -1 <<< "$subject")" \
1726
env:
1827
# Needed so that CI triggers
1928
GH_TOKEN: ${{ secrets.MACHINE_USER_PAT }}

0 commit comments

Comments
 (0)