Skip to content

Commit

Permalink
Move update testing to the update workflow (#50)
Browse files Browse the repository at this point in the history
Also, don't restrict pull_request workflows to the main branch.
  • Loading branch information
philiptaron committed Apr 20, 2024
2 parents 2890407 + 97b9ba7 commit b82b53e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 23 deletions.
22 changes: 0 additions & 22 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: CI
on:
pull_request:
branches:
- main
push:
branches:
- main
Expand Down Expand Up @@ -37,23 +35,3 @@ jobs:
run: scripts/release.sh
env:
GH_TOKEN: ${{ github.token }}

test-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

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

- name: test update script
run: |
nix-build -A autoPrUpdate
{
result/bin/auto-pr-update .
echo ""
echo '```diff'
git diff
echo '```'
} > $GITHUB_STEP_SUMMARY
env:
GH_TOKEN: ${{ github.token }}
15 changes: 14 additions & 1 deletion .github/workflows/update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ on:
workflow_dispatch: # Allows triggering manually
schedule:
- cron: '47 14 * * 1' # runs every Monday at 14:47 UTC (chosen somewhat randomly)
pull_request:

jobs:
update:
Expand All @@ -14,14 +15,26 @@ jobs:

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

- name: update
- name: Run update script
run: |
nix-build repo -A autoPrUpdate
result/bin/auto-pr-update repo > body
env:
GH_TOKEN: ${{ github.token }}

- name: Output result
if: ${{ github.event_name == 'pull_request' }}
run: |
{
cat body
echo ""
echo '```diff'
git -C repo diff
echo '```'
} > $GITHUB_STEP_SUMMARY
- name: Create Pull Request
if: ${{ github.event_name != 'pull_request' }}
uses: peter-evans/create-pull-request@v6
with:
# To trigger CI for automated PRs, we use a separate machine account
Expand Down

0 comments on commit b82b53e

Please sign in to comment.