Skip to content

adding workflow files #2950

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
0e75a5e
adding workflow files
jagdish-15 Jun 5, 2025
8d03422
Update .github/workflows/configlet-sync.yml
jagdish-15 Jun 5, 2025
0f84382
Update configlet-sync.yml to fix the command for tests
jagdish-15 Jun 7, 2025
853188c
Merge branch 'main' into add-sync-workflow
jagdish-15 Jun 7, 2025
4bc9381
Update configlet-sync.yml to ensure no duplicate issues are opened
jagdish-15 Jun 7, 2025
10a2a27
Merge pull request #2 from jagdish-15/add-sync-workflow
jagdish-15 Jun 8, 2025
14e89a1
Refactoring yml workflow for tests
jagdish-15 Jun 8, 2025
0cf40a5
Merge pull request #3 from jagdish-15/add-sync-workflow
jagdish-15 Jun 8, 2025
7730a50
Removing line causing error
jagdish-15 Jun 8, 2025
ab56210
Merge branch 'main' into add-sync-workflow
jagdish-15 Jun 8, 2025
527450f
Updating sync test
jagdish-15 Jun 8, 2025
f8dc41e
Merge branch 'add-sync-workflow' of https://github.com/jagdish-15/jav…
jagdish-15 Jun 8, 2025
6cbcf91
Updating sync test
jagdish-15 Jun 8, 2025
4491143
Updating workflow file to print body od the issue
jagdish-15 Jun 8, 2025
1f942d8
Adding GitHub API integration to ensure no duplicate issues are opened
jagdish-15 Jun 8, 2025
5a8b785
Adding backticks in issue content
jagdish-15 Jun 8, 2025
84f2619
Removing unnecesarry mkdir command
jagdish-15 Jun 8, 2025
82da5d0
Adding tests command
jagdish-15 Jun 8, 2025
b76a630
variable name mismatch
jagdish-15 Jun 8, 2025
231b7e8
Merge branch 'main' into add-sync-workflow
jagdish-15 Jun 9, 2025
81c27ee
Merge branch 'main' into add-sync-workflow
jagdish-15 Jun 13, 2025
ab090e7
Refactoring workflow into two different jobs and adding option to not…
jagdish-15 Jun 13, 2025
17754a0
removing env toggle for second job
jagdish-15 Jun 14, 2025
8f050cf
Removing dependency by replacing body-path by body
jagdish-15 Jun 14, 2025
d7f6607
Removing dependency by removing auto-sync dir and its usage
jagdish-15 Jun 14, 2025
4e7efff
Removing needs statement
jagdish-15 Jun 14, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
91 changes: 91 additions & 0 deletions .github/workflows/configlet-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Configlet Auto Sync

on:
workflow_dispatch:
schedule:
- cron: '0 0 15 * *'

jobs:
sync-docs-metadata:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Fetch configlet
run: ./bin/fetch-configlet

- name: Run configlet sync for files
run: ./bin/configlet sync --docs --metadata --filepaths -u -y

- name: Create pull request if changes
uses: peter-evans/create-pull-request@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: "🤖 Auto-sync docs, metadata, and filepaths"
title: "🤖 Configlet sync: docs, metadata, and filepaths"
body: |
This PR was generated automatically by a scheduled workflow.

It includes updates from `configlet sync` for:
- 📄 Documentation
- 🧭 Metadata
- 🗂️ Filepaths

Please review and merge if everything looks good!
branch: configlet-auto-sync
delete-branch: true

check-test-sync:
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Fetch configlet
run: ./bin/fetch-configlet

- name: Run configlet sync for test and capture output
id: sync_test
run: |
configlet_raw_output="$(./bin/configlet sync --tests | tee .github/sync-test-output.txt)"

echo "configlet output:"
echo "$configlet_raw_output"

echo '```' > .github/sync-test-output.txt
echo "$configlet_raw_output" >> .github/sync-test-output.txt
echo '```' >> .github/sync-test-output.txt

echo "output<<EOF" >> "$GITHUB_OUTPUT"
echo "$configlet_raw_output" >> "$GITHUB_OUTPUT"
echo "EOF" >> "$GITHUB_OUTPUT"

- name: Find existing issue for test sync
id: find_issue
if: ${{ !contains(steps.sync_test.outputs.output, 'Every exercise has up-to-date tests!') }}
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
ISSUE_TITLE="🚨 configlet sync --test found unsynced tests"
ISSUE_DATA=$(gh issue list --search "is:issue is:open in:title \"${ISSUE_TITLE}\" repo:${{ github.repository }}" --json number,title --jq '.[0]')

if [ -z "$ISSUE_DATA" ]; then
echo "No open issue found with title: '${ISSUE_TITLE}'. A new one will be created."
echo "issue_number=" >> $GITHUB_OUTPUT
else
ISSUE_NUMBER=$(echo "$ISSUE_DATA" | jq -r '.number')
echo "Found existing issue number: $ISSUE_NUMBER for title: '$ISSUE_TITLE'"
echo "issue_number=$ISSUE_NUMBER" >> $GITHUB_OUTPUT
fi

- name: Create or Update issue if tests are not synced
if: ${{ !contains(steps.sync_test.outputs.output, 'Every exercise has up-to-date tests!') }}
uses: peter-evans/create-issue-from-file@v5
with:
token: ${{ secrets.GITHUB_TOKEN }}
title: "🚨 configlet sync --test found unsynced tests"
content-filepath: .github/sync-test-output.txt
issue-number: ${{ steps.find_issue.outputs.issue_number || '' }}