Skip to content

Commit 2b166fc

Browse files
committed
fix: temporary trigger for testing
1 parent fd582a5 commit 2b166fc

1 file changed

Lines changed: 51 additions & 55 deletions

File tree

Lines changed: 51 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
name: Check for New Quarter and Update Deployed Terms if needed
22

33
on:
4+
push:
5+
branches: [fp/auto-quarter-rollover]
46
schedule:
57
- cron: '0 * * * *'
68
workflow_dispatch:
7-
9+
810
env:
911
ANTEATER_API_KEY: ${{ secrets.ANTEATER_API_KEY }}
1012

@@ -19,7 +21,7 @@ jobs:
1921
uses: actions/checkout@v4
2022
with:
2123
token: ${{ secrets.GITHUB_TOKEN }}
22-
24+
2325
- name: Configure Git
2426
run: |
2527
git config user.name "github-actions[bot]"
@@ -28,61 +30,55 @@ jobs:
2830
- name: Check for new Terms
2931
id: check
3032
run: |
31-
echo "Fetching latest terms from AnteaterAPI..."
32-
API_RESPONSE=$(curl -s https://anteaterapi.com/v2/rest/websoc/terms)
33-
34-
if [ -z "$API_RESPONSE" ]; then
35-
echo "Error: AnteaterAPI returned an empty response"
36-
exit 1
37-
fi
38-
39-
if ! echo "$API_RESPONSE" | jq empty 2>/dev/null; then
40-
echo "Error: AnteaterAPI returned invalid JSON"
41-
exit 1
42-
fi
43-
44-
LATEST_TERM=$(echo "$API_RESPONSE" | jq -r '.data[0].longName')
45-
46-
if [ ! -f .github/deployed_terms.json ]; then
47-
echo "deployed_terms.json does not exist"
48-
echo "Creating initial deployed_terms.json..."
49-
echo "$API_RESPONSE" > .github/deployed_terms.json
50-
echo "update_needed=true" >> $GITHUB_OUTPUT
51-
echo "new_term=$LATEST_TERM" >> $GITHUB_OUTPUT
52-
echo "reason=initial deployed terms tracking file not generated" >> $GITHUB_OUTPUT
53-
54-
exit 0
55-
fi
56-
57-
LATEST_DEPLOYED=$(cat .github/deployed_terms.json | jq -r '.data[0].longName')
58-
59-
echo "Latest term from API: $LATEST_TERM"
60-
echo "Latest deployed term: $LATEST_DEPLOYED"
61-
62-
if [[ "$LATEST_DEPLOYED" == "$LATEST_TERM" ]]; then
63-
echo "No new quarter found"
64-
echo "update_needed=false" >> $GITHUB_OUTPUT
65-
else
66-
echo "New quarter detected!"
67-
echo "update_needed=true" >> $GITHUB_OUTPUT
68-
echo "new_term=$LATEST_TERM" >> $GITHUB_OUTPUT
69-
echo "reason=new quarter available, trigger rebuild" >> $GITHUB_OUTPUT
70-
echo "$API_RESPONSE" > .github/deployed_terms.json
71-
fi
33+
echo "Fetching latest terms from AnteaterAPI..."
34+
API_RESPONSE=$(curl -s https://anteaterapi.com/v2/rest/websoc/terms)
35+
36+
if [ -z "$API_RESPONSE" ]; then
37+
echo "Error: AnteaterAPI returned an empty response"
38+
exit 1
39+
fi
40+
41+
if ! echo "$API_RESPONSE" | jq empty 2>/dev/null; then
42+
echo "Error: AnteaterAPI returned invalid JSON"
43+
exit 1
44+
fi
45+
46+
LATEST_TERM=$(echo "$API_RESPONSE" | jq -r '.data[0].longName')
47+
48+
if [ ! -f .github/deployed_terms.json ]; then
49+
echo "deployed_terms.json does not exist"
50+
echo "Creating initial deployed_terms.json..."
51+
echo "$API_RESPONSE" > .github/deployed_terms.json
52+
echo "update_needed=true" >> $GITHUB_OUTPUT
53+
echo "new_term=$LATEST_TERM" >> $GITHUB_OUTPUT
54+
echo "reason=initial deployed terms tracking file not generated" >> $GITHUB_OUTPUT
55+
56+
exit 0
57+
fi
58+
59+
LATEST_DEPLOYED=$(cat .github/deployed_terms.json | jq -r '.data[0].longName')
60+
61+
echo "Latest term from API: $LATEST_TERM"
62+
echo "Latest deployed term: $LATEST_DEPLOYED"
63+
64+
if [[ "$LATEST_DEPLOYED" == "$LATEST_TERM" ]]; then
65+
echo "No new quarter found"
66+
echo "update_needed=false" >> $GITHUB_OUTPUT
67+
else
68+
echo "New quarter detected!"
69+
echo "update_needed=true" >> $GITHUB_OUTPUT
70+
echo "new_term=$LATEST_TERM" >> $GITHUB_OUTPUT
71+
echo "reason=new quarter available, trigger rebuild" >> $GITHUB_OUTPUT
72+
echo "$API_RESPONSE" > .github/deployed_terms.json
73+
fi
7274
7375
- name: Commit and push updated terms
7476
if: steps.check.outputs.update_needed == 'true'
7577
run: |
76-
git add .github/deployed_terms.json
77-
git commit -m "ci: ${{ steps.check.outputs.reason }}" \
78-
-m "New term: ${{ steps.check.outputs.new_term }}" \
79-
-m "Auto-updated by workflow on $(date -u +%Y-%m-%d)"
80-
81-
git push origin main
82-
echo "Updated deployed_terms.json and triggered rebuild"
83-
84-
85-
86-
87-
78+
git add .github/deployed_terms.json
79+
git commit -m "ci: ${{ steps.check.outputs.reason }}" \
80+
-m "New term: ${{ steps.check.outputs.new_term }}" \
81+
-m "Auto-updated by workflow on $(date -u +%Y-%m-%d)"
8882
83+
git push origin main
84+
echo "Updated deployed_terms.json and triggered rebuild"

0 commit comments

Comments
 (0)