Skip to content
This repository was archived by the owner on Dec 25, 2025. It is now read-only.

Commit 5573bb5

Browse files
authored
Merge pull request #10 from Jebel-Quant/copilot/add-action-output-true-false
Add changes-detected output to action
2 parents 0d1ae48 + d870a27 commit 5573bb5

File tree

3 files changed

+50
-1
lines changed

3 files changed

+50
-1
lines changed

.github/workflows/integration-test.yml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,20 @@ jobs:
2222
run: ./tests/test-action.sh
2323

2424
- name: Test action in workflow
25+
id: test-sync
2526
uses: ./
2627
with:
2728
token: ${{ secrets.GITHUB_TOKEN }}
2829
source: '.github/template.yml'
2930
branch: test-branch
30-
test-mode: "true"
31+
test-mode: "true"
32+
33+
- name: Verify changes-detected output
34+
run: |
35+
echo "Changes detected: ${{ steps.test-sync.outputs.changes-detected }}"
36+
if [[ "${{ steps.test-sync.outputs.changes-detected }}" == "true" ]] || [[ "${{ steps.test-sync.outputs.changes-detected }}" == "false" ]]; then
37+
echo "✅ Output is valid (true or false)"
38+
else
39+
echo "❌ Output is invalid: ${{ steps.test-sync.outputs.changes-detected }}"
40+
exit 1
41+
fi

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,39 @@ jobs:
4343
| test-mode | If true, skip push and PR creation | No | false |
4444
| automerge | If true, enable auto-merge for the created PR | No | false |
4545
46+
## Outputs
47+
48+
| Output | Description |
49+
|--------|-------------|
50+
| changes-detected | Whether changes were detected during the sync (`true` or `false`) |
51+
52+
### Using Outputs
53+
54+
You can use the `changes-detected` output in subsequent steps. This is particularly useful in test mode:
55+
56+
```yaml
57+
jobs:
58+
sync:
59+
runs-on: ubuntu-latest
60+
61+
steps:
62+
- name: Sync Template
63+
id: sync
64+
uses: jebel-quant/sync_template@v0.4.1
65+
with:
66+
source: './template.yml'
67+
token: ${{ secrets.GITHUB_TOKEN }}
68+
test-mode: "true"
69+
70+
- name: Check if changes were detected
71+
run: |
72+
if [[ "${{ steps.sync.outputs.changes-detected }}" == "true" ]]; then
73+
echo "Changes were detected!"
74+
else
75+
echo "No changes detected."
76+
fi
77+
```
78+
4679

4780
## How It Works
4881

action.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@ inputs:
2525
description: 'Tag or branch to check out from the template repository (overrides template-branch)'
2626
required: false
2727

28+
outputs:
29+
changes-detected:
30+
description: 'Whether changes were detected during the sync (true or false)'
31+
value: ${{ steps.commit-changes.outputs.changes_detected }}
32+
2833
runs:
2934
using: "composite"
3035
steps:

0 commit comments

Comments
 (0)