-
-
Notifications
You must be signed in to change notification settings - Fork 735
Add deprecated workflow #3026
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
Add deprecated workflow #3026
Changes from 4 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a578ae9
Add workflow for deprecated exercises
jagdish-15 d6337ac
Mark test-deprecated-exercises as executable
jagdish-15 2d63504
Updating script
jagdish-15 214d71e
Dynamically load deprecated files from config.json using jq
jagdish-15 ae1d4b4
Remove `install jq` step from the workflow
jagdish-15 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,17 @@ | ||
name: Deprecated | ||
|
||
on: | ||
pull_request: | ||
|
||
jobs: | ||
test-deprecated: | ||
name: Check for deprecated exercises | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install jq | ||
run: sudo apt-get update && sudo apt-get install -y jq | ||
- name: Test deprecated exercises using test-deprecated-exercises | ||
run: bin/test-deprecated-exercises |
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,42 @@ | ||
#!/usr/bin/env bash | ||
set -eo pipefail | ||
|
||
# Determine the base branch of the PR | ||
BASE_BRANCH=${GITHUB_BASE_REF:-main} | ||
|
||
# Fetch full history for proper diff | ||
git fetch origin "$BASE_BRANCH" | ||
|
||
# Compute merge base | ||
MERGE_BASE=$(git merge-base HEAD origin/"$BASE_BRANCH") | ||
|
||
# Get changed files relative to merge base | ||
changed_files=$(git diff --name-only "$MERGE_BASE" HEAD) | ||
|
||
# Extract unique exercise directories | ||
changed_exercises=$(echo "$changed_files" | grep -E '^exercises/(practice|concept)/' || true) | ||
changed_exercises=$(echo "$changed_exercises" | cut -d/ -f1-3 | sort -u) | ||
|
||
# Early exit if no exercise changed | ||
if [ -z "$changed_exercises" ]; then | ||
echo "No exercises changed!" | ||
exit 0 | ||
fi | ||
|
||
# Load deprecated exercises from config.json | ||
deprecated_exercises=$(jq -r ' | ||
[ | ||
(.exercises.concept[]? | select(.status=="deprecated") | "exercises/concept/" + .slug), | ||
(.exercises.practice[]? | select(.status=="deprecated") | "exercises/practice/" + .slug) | ||
] | .[] | ||
' config.json) | ||
|
||
# Check for deprecated ones | ||
for ex in $changed_exercises; do | ||
if echo "$deprecated_exercises" | grep -qx "$ex"; then | ||
echo "❌ Deprecated exercise changed: $ex" | ||
exit 1 | ||
fi | ||
done | ||
|
||
echo "✅ No deprecated exercises changed!" |
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.