1414 default : false
1515 type : boolean
1616
17+ permissions : {}
18+
1719concurrency :
18- group : grammar-sync
20+ group : ${{ github.workflow }}-${{ github.ref }}
1921 cancel-in-progress : true
2022
2123env :
2426
2527jobs :
2628 sync-grammar :
29+ name : Sync Tolk Grammar
2730 runs-on : ubuntu-latest
2831 if : github.repository == 'ton-blockchain/ton-language-server'
32+
2933 permissions :
3034 contents : read
3135
3236 steps :
3337 - name : Checkout source repository
34- uses : actions/checkout@v6
38+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
3539 with :
40+ persist-credentials : false
3641 fetch-depth : 0
3742 path : source
3843
3944 - name : Checkout target repository
40- uses : actions/checkout@v6
45+ uses : actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
4146 with :
47+ persist-credentials : false
4248 repository : ${{ env.GRAMMAR_REPO }}
4349 token : ${{ secrets.GRAMMAR_SYNC_TOKEN }}
4450 path : target
5056 git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
5157
5258 - name : Sync grammar files
59+ env :
60+ SOURCE_GRAMMAR_PATH : ${{ env.GRAMMAR_PATH }}
5361 run : |
5462 rsync -a --delete \
5563 --exclude='.git' \
5866 --exclude='build' \
5967 --exclude='target' \
6068 --exclude='.DS_Store' \
61- "source/${{ env.GRAMMAR_PATH } }/" "target/"
69+ "source/${SOURCE_GRAMMAR_PATH }/" "target/"
6270
6371 - name : Check for changes
6472 id : changes
7785 - name : Create commit and push
7886 if : steps.changes.outputs.has_changes == 'true' || github.event.inputs.force_sync == 'true'
7987 working-directory : target
88+ env :
89+ FORCE_SYNC : ${{ github.event.inputs.force_sync || 'false' }}
8090 run : |
8191 # Get the latest commit info from source
8292 cd ../source
8797 cd ../target
8898
8999 # Create commit message
90- if [ "${{ github.event.inputs.force_sync }} " = "true" ]; then
100+ if [ "$FORCE_SYNC " = "true" ]; then
91101 SYNC_MSG="chore: force sync from ton-language-server@${COMMIT_SHA:0:7}"
92102 else
93103 SYNC_MSG="sync: ${COMMIT_MSG}"
@@ -104,14 +114,19 @@ jobs:
104114 git push origin main
105115
106116 - name : Create summary
117+ env :
118+ FORCE_SYNC : ${{ github.event.inputs.force_sync || 'false' }}
119+ HAS_CHANGES : ${{ steps.changes.outputs.has_changes }}
120+ TARGET_GRAMMAR_REPO : ${{ env.GRAMMAR_REPO }}
121+ TRIGGER_EVENT : ${{ github.event_name }}
107122 run : |
108- echo "## Grammar Sync Summary" >> $GITHUB_STEP_SUMMARY
109- echo "" >> $GITHUB_STEP_SUMMARY
110- if [ "${{ steps.changes.outputs.has_changes }} " = "true" ] || [ "${{ github.event.inputs.force_sync }} " = "true" ]; then
111- echo "✅ Grammar successfully synced to [${{ env.GRAMMAR_REPO }} ](https://github.com/${{ env.GRAMMAR_REPO }} )" >> $GITHUB_STEP_SUMMARY
112- echo "" >> $GITHUB_STEP_SUMMARY
113- echo "**Source commit:** $(cd source && git rev-parse HEAD)" >> $GITHUB_STEP_SUMMARY
114- echo "**Trigger:** ${{ github.event_name }} " >> $GITHUB_STEP_SUMMARY
123+ echo "## Grammar Sync Summary" >> " $GITHUB_STEP_SUMMARY"
124+ echo "" >> " $GITHUB_STEP_SUMMARY"
125+ if [ "$HAS_CHANGES " = "true" ] || [ "$FORCE_SYNC " = "true" ]; then
126+ echo "✅ Grammar successfully synced to [${TARGET_GRAMMAR_REPO} ](https://github.com/${TARGET_GRAMMAR_REPO} )" >> " $GITHUB_STEP_SUMMARY"
127+ echo "" >> " $GITHUB_STEP_SUMMARY"
128+ echo "**Source commit:** $(cd source && git rev-parse HEAD)" >> " $GITHUB_STEP_SUMMARY"
129+ echo "**Trigger:** $TRIGGER_EVENT " >> " $GITHUB_STEP_SUMMARY"
115130 else
116- echo "ℹ️ No changes to sync" >> $GITHUB_STEP_SUMMARY
131+ echo "ℹ️ No changes to sync" >> " $GITHUB_STEP_SUMMARY"
117132 fi
0 commit comments