@@ -2,21 +2,24 @@ name: Update OpenAPI Specification
22
33on :
44 workflow_dispatch :
5+ schedule :
6+ - cron : " */30 * * * *"
7+
58jobs :
69 update-openapi :
710 runs-on : ubuntu-latest
8- permissions :
11+ permissions :
912 contents : write
1013 pull-requests : write
1114 steps :
1215 - name : Checkout repository
1316 uses : actions/checkout@v4
14-
17+
1518 - name : Fetch OpenAPI specification
1619 run : |
1720 npm install -g fern-api
1821 fern api update
19-
22+
2023 - name : Check for changes
2124 id : check_changes
2225 run : |
@@ -27,28 +30,28 @@ jobs:
2730 echo "Changes detected in OpenAPI specification"
2831 echo "changes_detected=true" >> $GITHUB_OUTPUT
2932 fi
30-
33+
3134 - name : Setup GitHub CLI
3235 id : setup_cli
3336 if : steps.check_changes.outputs.changes_detected == 'true'
3437 run : |
3538 # Create timestamp for unique branch name
3639 TIMESTAMP=$(date +%Y%m%d%H%M%S)
3740 BRANCH_NAME="update-openapi-spec-${TIMESTAMP}"
38-
41+
3942 # Setup branch for changes
4043 git config --global user.name "GitHub Actions"
4144 git config --global user.email "[email protected] " 42-
45+
4346 # Create new branch with timestamp
4447 git checkout -b $BRANCH_NAME
4548 git add ./fern/apis/api/openapi.json
4649 git commit -m "chore: update OpenAPI specification"
4750 git push -u origin $BRANCH_NAME
48-
51+
4952 # Store branch name for PR creation
5053 echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT
51-
54+
5255 - name : Create Pull Request with GitHub CLI
5356 if : steps.check_changes.outputs.changes_detected == 'true'
5457 run : |
@@ -63,13 +66,13 @@ jobs:
6366 - Generated at: $(date -u +'%Y-%m-%dT%H:%M:%SZ')"
6467 env :
6568 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
66-
69+
6770 - name : PR Result
6871 if : steps.check_changes.outputs.changes_detected == 'true'
6972 run : |
7073 echo "Pull request created successfully!"
71-
74+
7275 - name : No Changes Result
7376 if : steps.check_changes.outputs.changes_detected == 'false'
7477 run : |
75- echo "No changes detected in OpenAPI specification. No PR created."
78+ echo "No changes detected in OpenAPI specification. No PR created."
0 commit comments