Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 16 additions & 7 deletions .github/workflows/command-pull-3rdparty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
if: github.event.issue.pull_request != '' && startsWith(github.event.comment.body, '/update-3rdparty')

steps:
- name: Check actor permission
uses: skjnldsv/check-actor-permission@69e92a3c4711150929bca9fcf34448c5bf5526e7 # v2
with:
require: write

- name: Add reaction on start
uses: peter-evans/create-or-update-comment@e8674b075228eee787fea43ef493e45ece1004c9 # v3.0.1
with:
Expand Down Expand Up @@ -64,14 +69,15 @@ jobs:
ref: ${{ steps.comment-branch.outputs.head_ref }}

- name: Register server reference to fallback to master branch
env:
BASE_REF: ${{ steps.get-pr.outputs.base_ref }}
run: |
base_ref="${{ steps.get-pr.outputs.base_ref }}"
if [[ "$base_ref" == "main" || "$base_ref" == "master" ]]; then
if [[ "$BASE_REF" == "main" || "$BASE_REF" == "master" ]]; then
echo "server_ref=master" >> "$GITHUB_ENV"
echo "Setting server_ref to master"
elif [[ "$base_ref" =~ ^stable[0-9]+$ ]]; then
echo "server_ref=$base_ref" >> "$GITHUB_ENV"
echo "Setting server_ref to $base_ref"
elif [[ "$BASE_REF" =~ ^stable[0-9]+$ ]]; then
echo "server_ref=$BASE_REF" >> "$GITHUB_ENV"
echo "Setting server_ref to $BASE_REF"
else
echo "Not based on master/main/stable*, so skipping pull 3rdparty command"
fi
Expand All @@ -92,13 +98,16 @@ jobs:

- name: Pull 3rdparty
if: ${{ env.server_ref != '' }}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switch away from env.server_ref here too?

run: git submodule foreach 'if [ "$sm_path" == "3rdparty" ]; then git pull origin '"'"'${{ env.server_ref }}'"'"'; fi'
run: git submodule foreach 'if [ "$sm_path" == "3rdparty" ]; then git pull origin "'"$server_ref"'"; fi'
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this changes the quotes from single to double quotes


- name: Commit and push changes
if: ${{ env.server_ref != '' }}
env:
BOT_TOKEN: ${{ secrets.COMMAND_BOT_PAT }}
run: |
git remote set-url origin "https://x-access-token:${BOT_TOKEN}@github.com/${{ github.repository }}.git"
git add 3rdparty
git commit -s -m 'Update submodule 3rdparty to latest ${{ env.server_ref }}'
git commit -s -m "Update submodule 3rdparty to latest ${server_ref}"
git push

- name: Add reaction on failure
Expand Down
Loading