fixup! TO-DROP: debug with tmate #6
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=56'" | |
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 | |
repository: ${{ github.repository_owner }}/${{ matrix.sdk }} | |
token: ${{ steps.sdk-repo-token.outputs.token }} | |
- 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: Remove ${{ env.PACKAGE }} | |
shell: bash | |
run: | | |
set -x && | |
. /etc/profile && | |
# Log the output also to a file so that it can be inserted into the commit message later | |
cygpath -aw /tmp/commit-message.txt && | |
(pacman -Rns --noconfirm $PACKAGE 2>&1; echo $? >/tmp/exit.status) | | |
tee -a /tmp/commit-message.txt && | |
exit $(cat /tmp/exit.status) | |
- 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" && | |
( | |
gh pr create \ | |
--title "Drop package '$PACKAGE'" \ | |
--body "$commit_message" \ | |
--head "$branch" \ | |
--base main; | |
echo $? >/tmp/exit.status | |
) | | |
tee -a /tmp/pr-create-output.txt && | |
test 0 = $(cat /tmp/exit.status) && | |
sed -n 's/.*\(http[^ ]*\).*/::notice::Opened PR \1/p' /tmp/pr-create-output.txt |