From a4b702448502a8afdf81aa8a86b1c290d85d3b46 Mon Sep 17 00:00:00 2001 From: Thalia Archibald Date: Tue, 30 Apr 2024 09:02:10 -0700 Subject: [PATCH 1/2] Keep spoiler history instead of force-pushing --- .github/workflows/main.yml | 9 +++++---- src/dot.github.workflows.main.yml.gen.rb | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 32eaf1cc..7465335b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,8 @@ jobs: sudo docker run --privileged --name qr -e CI=true -t quine-relay - name: push spoiler run: | - mkdir spoiler + git clone https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/mame/quine-relay.git spoiler --branch spoiler + git -C spoiler rm --quiet -r '*' sudo docker cp qr:/usr/local/share/quine-relay/QR.rb spoiler/ sudo docker cp qr:/usr/local/share/quine-relay/QR.rs spoiler/ sudo docker cp qr:/usr/local/share/quine-relay/QR.scala spoiler/ @@ -146,12 +147,12 @@ jobs: sudo docker cp qr:/usr/local/share/quine-relay/QR.rc spoiler/ sudo docker cp qr:/usr/local/share/quine-relay/QR.rexx spoiler/ cd spoiler - git init --quiet git config user.name 'Yusuke Endoh' git config user.email 'mame@ruby-lang.org' git add . - git commit -m spoiler --quiet - git push --force --quiet https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/mame/quine-relay.git master:spoiler + TZ=Asia/Tokyo \ + git commit --allow-empty -m "spoiler: $(git show -s --format=%s "$GITHUB_SHA")" + git push --quiet origin spoiler echo The intermediate sources are available: https://github.com/mame/quine-relay/tree/spoiler if: github.event_name == 'push' && github.ref == 'refs/heads/master' env: diff --git a/src/dot.github.workflows.main.yml.gen.rb b/src/dot.github.workflows.main.yml.gen.rb index 11c3811b..716d0b87 100644 --- a/src/dot.github.workflows.main.yml.gen.rb +++ b/src/dot.github.workflows.main.yml.gen.rb @@ -30,15 +30,16 @@ sudo docker run --privileged --name qr -e CI=true -t quine-relay - name: push spoiler run: | - mkdir spoiler + git clone https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/mame/quine-relay.git spoiler --branch spoiler + git -C spoiler rm --quiet -r '*' #{ cp_cmds } cd spoiler - git init --quiet git config user.name 'Yusuke Endoh' git config user.email 'mame@ruby-lang.org' git add . - git commit -m spoiler --quiet - git push --force --quiet https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/mame/quine-relay.git master:spoiler + TZ=Asia/Tokyo \ + git commit --allow-empty -m "spoiler: $(git show -s --format=%s "$GITHUB_SHA")" + git push --quiet origin spoiler echo The intermediate sources are available: https://github.com/mame/quine-relay/tree/spoiler if: github.event_name == 'push' && github.ref == 'refs/heads/master' env: From 198a6d76fb95989c3feb26c4390966db591f793a Mon Sep 17 00:00:00 2001 From: Thalia Archibald Date: Tue, 30 Apr 2024 09:31:14 -0700 Subject: [PATCH 2/2] Support forks for spoiler and use author metadata --- .github/workflows/main.yml | 13 ++++++++----- src/dot.github.workflows.main.yml.gen.rb | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 7465335b..4594525e 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,7 +16,7 @@ jobs: sudo docker run --privileged --name qr -e CI=true -t quine-relay - name: push spoiler run: | - git clone https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/mame/quine-relay.git spoiler --branch spoiler + git clone https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git spoiler --branch spoiler git -C spoiler rm --quiet -r '*' sudo docker cp qr:/usr/local/share/quine-relay/QR.rb spoiler/ sudo docker cp qr:/usr/local/share/quine-relay/QR.rs spoiler/ @@ -147,13 +147,16 @@ jobs: sudo docker cp qr:/usr/local/share/quine-relay/QR.rc spoiler/ sudo docker cp qr:/usr/local/share/quine-relay/QR.rexx spoiler/ cd spoiler - git config user.name 'Yusuke Endoh' - git config user.email 'mame@ruby-lang.org' git add . - TZ=Asia/Tokyo \ + GIT_AUTHOR_NAME="$(git show -s --format=%an "$GITHUB_SHA")" \ + GIT_AUTHOR_EMAIL="$(git show -s --format=%ae "$GITHUB_SHA")" \ + GIT_AUTHOR_DATE="$(git show -s --format=%ad "$GITHUB_SHA")" \ + GIT_COMMITTER_NAME='GitHub Actions' \ + GIT_COMMITTER_EMAIL='actions@github.com' \ + TZ=UTC \ git commit --allow-empty -m "spoiler: $(git show -s --format=%s "$GITHUB_SHA")" git push --quiet origin spoiler - echo The intermediate sources are available: https://github.com/mame/quine-relay/tree/spoiler + echo The intermediate sources are available: https://github.com/${GITHUB_REPOSITORY}/tree/spoiler if: github.event_name == 'push' && github.ref == 'refs/heads/master' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/src/dot.github.workflows.main.yml.gen.rb b/src/dot.github.workflows.main.yml.gen.rb index 716d0b87..88a12dbc 100644 --- a/src/dot.github.workflows.main.yml.gen.rb +++ b/src/dot.github.workflows.main.yml.gen.rb @@ -30,17 +30,20 @@ sudo docker run --privileged --name qr -e CI=true -t quine-relay - name: push spoiler run: | - git clone https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/mame/quine-relay.git spoiler --branch spoiler + git clone https://${GITHUB_ACTOR}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git spoiler --branch spoiler git -C spoiler rm --quiet -r '*' #{ cp_cmds } cd spoiler - git config user.name 'Yusuke Endoh' - git config user.email 'mame@ruby-lang.org' git add . - TZ=Asia/Tokyo \ + GIT_AUTHOR_NAME="$(git show -s --format=%an "$GITHUB_SHA")" \ + GIT_AUTHOR_EMAIL="$(git show -s --format=%ae "$GITHUB_SHA")" \ + GIT_AUTHOR_DATE="$(git show -s --format=%ad "$GITHUB_SHA")" \ + GIT_COMMITTER_NAME='GitHub Actions' \ + GIT_COMMITTER_EMAIL='actions@github.com' \ + TZ=UTC \ git commit --allow-empty -m "spoiler: $(git show -s --format=%s "$GITHUB_SHA")" git push --quiet origin spoiler - echo The intermediate sources are available: https://github.com/mame/quine-relay/tree/spoiler + echo The intermediate sources are available: https://github.com/${GITHUB_REPOSITORY}/tree/spoiler if: github.event_name == 'push' && github.ref == 'refs/heads/master' env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}