TO-DROP: only run on git-sdk-arm64 #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Drop Pacman package from SDKs | |
on: | |
push: | |
env: | |
PACKAGE: git-flow | |
COMMIT_MESSAGE: The Git Flow package is obsolete and unmaintained. It is no longer distributed with Git for Windows, see https://github.com/git-for-windows/build-extra/pull/648 for details. | |
GIT_CONFIG_PARAMETERS: "'user.name=Git for Windows Build Agent' '[email protected]' 'windows.sdk64.path=${{ github.workspace }}' 'windows.sdk32.path=' 'http.sslbackend=schannel' 'core.autocrlf=false' 'checkout.workers=16'" | |
HOME: "${{ github.workspace }}\\home\\git-ci" | |
MSYSTEM: MSYS | |
jobs: | |
drop-pacman-package: | |
strategy: | |
matrix: | |
sdk: [git-sdk-arm64] | |
runs-on: ${{ matrix.sdk == 'git-sdk-arm64' && 'windows-11-arm' || 'windows-latest' }} | |
steps: | |
- name: obtain installation access token | |
uses: actions/create-github-app-token@v2 | |
id: sdk-repo-token | |
with: | |
app-id: ${{ secrets.GH_APP_ID }} | |
private-key: ${{ secrets.GH_APP_PRIVATE_KEY }} | |
owner: ${{ github.repository_owner }} | |
repositories: ${{ matrix.sdk }} | |
- name: clone ${{ matrix.sdk }} | |
uses: actions/checkout@v5 | |
with: | |
persist-credentials: true | |
token: ${{ steps.sdk-repo-token.outputs.token }} | |
- name: Update all Pacman packages | |
shell: pwsh | |
run: | | |
# Log the output also to a file so that it can be inserted into the commit message later | |
& .\usr\bin\bash.exe -lc 'set -x && exec > >(tee -a /tmp/commit-message.txt) 2>&1 && pacman -Rns --noconfirm $PACKAGE' | |
- name: use the SDK's Bash and git.exe | |
run: "usr\\bin\\bash.exe -lc 'cygpath -aw /usr/bin >>$GITHUB_PATH && cygpath -aw /cmd >>$GITHUB_PATH'" | |
- name: commit & open PR | |
shell: bash | |
run: | | |
set -x && | |
branch="drop-$PACKAGE-$(date +%s)" && | |
git checkout -b "$branch" && | |
git add -A . && | |
if git diff --cached --quiet; then | |
echo "::warning::${{ matrix.sdk }}: no changes to commit!" | |
exit 0 | |
fi && | |
commit_message="Drop package '$PACKAGE' | |
$COMMIT_MESSAGE | |
$(cat /tmp/commit-message.txt)" && | |
git -c core.quotepath=false -c log.showSignature=false commit -m "$commit_message" && | |
( | |
exec > >(tee /tmp/pr-create-output.txt) 2>&1 && | |
gh pr create \ | |
--title "Drop package '$PACKAGE'" \ | |
--body "$commit_message" \ | |
--head "$branch" \ | |
--base main | |
) && | |
sed -n 's/.*\(http[^ ]*\).*/::notice::Opened PR \1/p' /tmp/pr-create-output.txt |