44 schedule :
55 - cron : " 0 0 * * *"
66 workflow_dispatch :
7+ pull_request :
8+ branches :
9+ - main
10+ paths :
11+ - .github/workflows/update-supported-enterprise-server-versions.yml
12+ - .github/workflows/update-supported-enterprise-server-versions/update.py
713
814jobs :
915 update-supported-enterprise-server-versions :
@@ -28,13 +34,15 @@ jobs:
2834 repository : github/enterprise-releases
2935 token : ${{ secrets.ENTERPRISE_RELEASE_TOKEN }}
3036 path : ${{ github.workspace }}/enterprise-releases/
37+ sparse-checkout : releases.json
3138 - name : Update Supported Enterprise Server Versions
3239 run : |
3340 cd ./.github/workflows/update-supported-enterprise-server-versions/
3441 python3 -m pip install pipenv
3542 pipenv install
3643 pipenv run ./update.py
3744 rm --recursive "$ENTERPRISE_RELEASES_PATH"
45+ npm ci
3846 npm run build
3947 env :
4048 ENTERPRISE_RELEASES_PATH : ${{ github.workspace }}/enterprise-releases/
@@ -44,25 +52,33 @@ jobs:
4452 git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
4553 git config --global user.name "github-actions[bot]"
4654
47- - name : Commit changes and open PR
48- env :
49- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
55+ - name : Commit changes
56+ id : prepare-commit
5057 run : |
5158 if [[ -z $(git status --porcelain) ]]; then
5259 echo "No changes to commit"
60+ echo "committed=false" >> $GITHUB_OUTPUT
5361 else
5462 git checkout -b update-supported-enterprise-server-versions
5563 git add .
5664 git commit --message "Update supported GitHub Enterprise Server versions"
57- git push origin update-supported-enterprise-server-versions
58-
59- body="This PR updates the list of supported GitHub Enterprise Server versions, either because a new "
60- body+="version is about to be feature frozen, or because an old release has been deprecated."
61- body+=$'\n\n'
62- body+="If an old release has been deprecated, please follow the instructions in CONTRIBUTING.md to "
63- body+="deprecate the corresponding version of CodeQL."
6465
65- gh pr create --draft \
66- --title "Update supported GitHub Enterprise Server versions" \
67- --body "$body"
66+ echo "committed=true" >> $GITHUB_OUTPUT
6867 fi
68+
69+ - name : Open PR
70+ if : github.event_name != 'pull_request' && steps.prepare-commit.outputs.committed == 'true'
71+ env :
72+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
73+ run : |
74+ git push origin update-supported-enterprise-server-versions
75+
76+ body="This PR updates the list of supported GitHub Enterprise Server versions, either because a new "
77+ body+="version is about to be feature frozen, or because an old release has been deprecated."
78+ body+=$'\n\n'
79+ body+="If an old release has been deprecated, please follow the instructions in CONTRIBUTING.md to "
80+ body+="deprecate the corresponding version of CodeQL."
81+
82+ gh pr create --draft \
83+ --title "Update supported GitHub Enterprise Server versions" \
84+ --body "$body"
0 commit comments