-
Notifications
You must be signed in to change notification settings - Fork 0
Add scheduled workflow to sync efcpt-config.schema.json from upstream #62
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
b2b9996
Initial plan
Copilot 02c6bb4
feat: add workflow to update EFCPT schema from upstream
Copilot 5e16398
refactor: simplify URL and remove redundant error check
Copilot ff9271b
chore: update peter-evans/create-pull-request to v8
Copilot aa75fe8
refactor: address code review feedback for workflow robustness
Copilot 4d1fbcc
fix: ensure consistent quoting of GITHUB_OUTPUT variable
Copilot File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| name: Update EFCPT Schema | ||
|
|
||
| on: | ||
| schedule: | ||
| # Run twice daily at 6:00 AM and 6:00 PM UTC | ||
| - cron: '0 6,18 * * *' | ||
| workflow_dispatch: | ||
| inputs: | ||
| reason: | ||
| description: 'Reason for manual run' | ||
| required: false | ||
| default: 'Manual schema update check' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| concurrency: | ||
| group: "update-schema-${{ github.ref }}" | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| check-and-update-schema: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 1 | ||
|
|
||
| - name: Download upstream schema | ||
| id: download | ||
| run: | | ||
| UPSTREAM_URL="https://raw.githubusercontent.com/ErikEJ/EFCorePowerTools/master/samples/efcpt-config.schema.json" | ||
| LOCAL_PATH="lib/efcpt-config.schema.json" | ||
|
|
||
| # Download the upstream schema to a temporary file | ||
| if ! curl -f -s -o /tmp/upstream-schema.json "$UPSTREAM_URL"; then | ||
| echo "Error: Failed to download upstream schema from $UPSTREAM_URL" >&2 | ||
| exit 1 | ||
| fi | ||
|
|
||
| # If the local schema file does not exist, treat this as a change and create it | ||
| if [ ! -f "$LOCAL_PATH" ]; then | ||
| echo "Local schema file '$LOCAL_PATH' not found. Creating it from upstream." | ||
| mkdir -p "$(dirname "$LOCAL_PATH")" | ||
| cp /tmp/upstream-schema.json "$LOCAL_PATH" | ||
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||
| echo "Changes detected in schema file (local file was missing)" | ||
| # Compare the files when the local schema exists | ||
| elif diff -q "$LOCAL_PATH" /tmp/upstream-schema.json; then | ||
| echo "has_changes=false" >> "$GITHUB_OUTPUT" | ||
| echo "No changes detected in schema file" | ||
| else | ||
| echo "has_changes=true" >> "$GITHUB_OUTPUT" | ||
| echo "Changes detected in schema file" | ||
| cp /tmp/upstream-schema.json "$LOCAL_PATH" | ||
| fi | ||
|
|
||
| - name: Create Pull Request | ||
| if: steps.download.outputs.has_changes == 'true' | ||
| uses: peter-evans/create-pull-request@v8 | ||
| with: | ||
| token: ${{ secrets.GITHUB_TOKEN }} | ||
| commit-message: 'chore: update efcpt-config.schema.json from upstream' | ||
| title: 'chore: Update EFCPT Schema from Upstream' | ||
| body: | | ||
| This PR updates the `/lib/efcpt-config.schema.json` file to match the upstream version from the EFCorePowerTools repository. | ||
|
|
||
| **Source**: https://raw.githubusercontent.com/ErikEJ/EFCorePowerTools/master/samples/efcpt-config.schema.json | ||
|
|
||
| This PR was automatically created by the scheduled workflow. | ||
| branch: automated/update-efcpt-schema | ||
| delete-branch: true | ||
| labels: | | ||
| dependencies | ||
| automated | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.