Skip to content

Commit 3428806

Browse files
authored
Manually trigger tests (#50)
2 parents 3c25114 + 5bb4d15 commit 3428806

File tree

2 files changed

+25
-6
lines changed

2 files changed

+25
-6
lines changed

.github/workflows/fpm-version-update.yml

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ jobs:
6161
- name: Update formula
6262
if: env.UPDATE_NEEDED == 'true'
6363
run: |
64-
TIMESTAMP=$(date +%s)
6564
RUN_ID="${{ github.run_id }}-${{ github.run_number }}"
6665
sed -i "1s/^/# Formula last updated on $(date -u +"%Y-%m-%dT%H:%M:%SZ") (Run: ${RUN_ID})\n/" Formula/fpm.rb
6766
sed -i "s|url \".*\"|url \"https://github.com/fortran-lang/fpm/releases/download/${{ env.LATEST_VERSION_V }}/fpm-${{ env.LATEST_VERSION }}.zip\"|" Formula/fpm.rb
@@ -95,12 +94,27 @@ jobs:
9594
automated-pr
9695
version-bump
9796
98-
# Wait for test-bot CI to complete (unchanged)
97+
- name: Trigger brew test-bot
98+
if: env.UPDATE_NEEDED == 'true' && steps.create-pr.outputs.pull-request-number
99+
uses: actions/github-script@v7
100+
with:
101+
github-token: ${{ secrets.GITHUB_TOKEN }}
102+
script: |
103+
await github.rest.actions.createWorkflowDispatch({
104+
owner: context.repo.owner,
105+
repo: context.repo.repo,
106+
workflow_id: 'test-bot.yml', # Must match the filename in .github/workflows/
107+
ref: 'main',
108+
inputs: {
109+
head_sha: '${{ steps.create-pr.outputs.pull-request-head-sha }}'
110+
}
111+
});
112+
113+
# Wait for test-bot CI to complete
99114
- name: Wait for test-bot to complete
100115
if: env.UPDATE_NEEDED == 'true' && steps.create-pr.outputs.pull-request-number
101116
run: |
102117
echo "Waiting for test-bot workflow to complete..."
103-
PR_NUMBER=${{ steps.create-pr.outputs.pull-request-number }}
104118
timeout=1800 # 30 minutes in seconds
105119
interval=60 # Check every minute
106120
elapsed=0
@@ -134,7 +148,7 @@ jobs:
134148
135149
- name: Add pr-pull label
136150
if: env.UPDATE_NEEDED == 'true' && steps.create-pr.outputs.pull-request-number
137-
uses: actions/github-script@v6
151+
uses: actions/github-script@v7
138152
with:
139153
github-token: ${{ secrets.GITHUB_TOKEN }}
140154
script: |

.github/workflows/tests.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ on:
44
branches:
55
- main
66
pull_request:
7+
workflow_dispatch: # Added to allow manual triggering from the main workflow
8+
inputs:
9+
head_sha: # Input for the PR’s head SHA
10+
description: 'Head SHA of the PR to test'
11+
required: true
712
jobs:
813
test-bot:
914
strategy:
@@ -42,12 +47,12 @@ jobs:
4247
- run: brew test-bot --only-tap-syntax
4348

4449
- run: brew test-bot --only-formulae
45-
if: github.event_name == 'pull_request'
50+
if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
4651
env:
4752
HOMEBREW_ARCH: ${{ matrix.arch }}
4853

4954
- name: Upload bottles as artifact
50-
if: always() && github.event_name == 'pull_request'
55+
if: always() && (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch')
5156
uses: actions/upload-artifact@v4
5257
with:
5358
name: bottles-${{ matrix.os }}-${{ matrix.arch }}

0 commit comments

Comments
 (0)