From 923d1d24790f921ed18df5e342dd651f11dfc687 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 15:24:23 +0000 Subject: [PATCH 1/4] Initial plan From e405004bdfcdd5d5608a08fc2f7ffc24d0611d26 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 15:29:17 +0000 Subject: [PATCH 2/4] Add GitHub Action to update nonce on issue open Co-authored-by: hesreallyhim <172150522+hesreallyhim@users.noreply.github.com> --- .github/workflows/update-nonce.yml | 56 ++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 .github/workflows/update-nonce.yml diff --git a/.github/workflows/update-nonce.yml b/.github/workflows/update-nonce.yml new file mode 100644 index 0000000..da8c037 --- /dev/null +++ b/.github/workflows/update-nonce.yml @@ -0,0 +1,56 @@ +--- +name: Update Nonce on Issue Open + +'on': + issues: + types: [opened] + +jobs: + update-nonce: + runs-on: ubuntu-latest + + steps: + - name: Check if issue body contains "nonce" + id: check-nonce + run: | + ISSUE_BODY="${{ github.event.issue.body }}" + if echo "$ISSUE_BODY" | grep -qi "nonce"; then + echo "contains_nonce=true" >> $GITHUB_OUTPUT + echo "Issue body contains 'nonce' - proceeding" + else + echo "contains_nonce=false" >> $GITHUB_OUTPUT + echo "Issue body does not contain 'nonce' - stopping" + fi + + - name: Checkout repository + if: steps.check-nonce.outputs.contains_nonce == 'true' + uses: actions/checkout@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + + - name: Update nonce in README + if: steps.check-nonce.outputs.contains_nonce == 'true' + run: | + # Generate a random 6-digit number + NEW_NONCE=$(printf "%06d" $((RANDOM % 1000000))) + echo "Generated new nonce: $NEW_NONCE" + + # Find and replace nonce=NNNNNN pattern with new nonce + PATTERN='//,//' + REPLACEMENT='s/nonce=[0-9]\{6\}/nonce='"$NEW_NONCE"'/g' + sed -i "${PATTERN}${REPLACEMENT}" README.md + + echo "Updated README.md with new nonce value" + + - name: Commit and push changes + if: steps.check-nonce.outputs.contains_nonce == 'true' + run: | + git config user.name "github-actions[bot]" + git config user.email "github-actions[bot]@users.noreply.github.com" + git add README.md + if git diff --staged --quiet; then + echo "No changes to commit" + else + git commit -m "Update nonce value in README [skip ci]" + git push + fi From 94cd291b7088067812f78760141deafb27d19713 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 15:34:15 +0000 Subject: [PATCH 3/4] Fix security issue and improve sed command clarity Co-authored-by: hesreallyhim <172150522+hesreallyhim@users.noreply.github.com> --- .github/workflows/update-nonce.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/update-nonce.yml b/.github/workflows/update-nonce.yml index da8c037..a606904 100644 --- a/.github/workflows/update-nonce.yml +++ b/.github/workflows/update-nonce.yml @@ -12,8 +12,9 @@ jobs: steps: - name: Check if issue body contains "nonce" id: check-nonce + env: + ISSUE_BODY: ${{ github.event.issue.body }} run: | - ISSUE_BODY="${{ github.event.issue.body }}" if echo "$ISSUE_BODY" | grep -qi "nonce"; then echo "contains_nonce=true" >> $GITHUB_OUTPUT echo "Issue body contains 'nonce' - proceeding" @@ -36,9 +37,10 @@ jobs: echo "Generated new nonce: $NEW_NONCE" # Find and replace nonce=NNNNNN pattern with new nonce - PATTERN='//,//' - REPLACEMENT='s/nonce=[0-9]\{6\}/nonce='"$NEW_NONCE"'/g' - sed -i "${PATTERN}${REPLACEMENT}" README.md + # Only within the NONCE section markers + NONCE_PATTERN='//,//' + NONCE_REPLACEMENT='s/nonce=[0-9]\{6\}/nonce='"$NEW_NONCE"'/g' + sed -i "${NONCE_PATTERN}${NONCE_REPLACEMENT}" README.md echo "Updated README.md with new nonce value" From fb85c5f6ba8db2c5786be1c7e170fba3571729be Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Thu, 6 Nov 2025 15:36:09 +0000 Subject: [PATCH 4/4] Add explicit GITHUB_TOKEN permissions to workflow Co-authored-by: hesreallyhim <172150522+hesreallyhim@users.noreply.github.com> --- .github/workflows/update-nonce.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/update-nonce.yml b/.github/workflows/update-nonce.yml index a606904..a33f367 100644 --- a/.github/workflows/update-nonce.yml +++ b/.github/workflows/update-nonce.yml @@ -8,6 +8,9 @@ name: Update Nonce on Issue Open jobs: update-nonce: runs-on: ubuntu-latest + permissions: + contents: write + issues: read steps: - name: Check if issue body contains "nonce"