Skip to content

autoupdate git action#1523

Merged
SFJohnson24 merged 2 commits intomainfrom
rerun
Jan 9, 2026
Merged

autoupdate git action#1523
SFJohnson24 merged 2 commits intomainfrom
rerun

Conversation

@SFJohnson24
Copy link
Copy Markdown
Collaborator

@SFJohnson24 SFJohnson24 commented Jan 9, 2026

This PR implements autoupdate. Whenever a push to main is made via a merge of a PR, the action runs. It takes the action's github token that is auto generated and uses that to access all PR's for the repository. It tries to update all the PRs in ready for review pipeline with the main code. If there are merge conflicts, it will skip those PRs. It tries to update the branch 2 times with 60 seconds between each attempt before moving on to the next PR without updating that branch. Once the PR updates the branch, the automated CI will kick in when the branch is updated and rerun the test suite

@SFJohnson24 SFJohnson24 self-assigned this Jan 9, 2026
Comment on lines +10 to +21
name: autoupdate
runs-on: ubuntu-22.04
steps:
- uses: docker://chinthakagodawita/autoupdate-action:v1
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
PR_FILTER: "all"
PR_READY_STATE: "ready_for_review"
MERGE_MSG: "Auto-updated branch with latest changes from main"
RETRY_COUNT: "2"
RETRY_SLEEP: "60000"
MERGE_CONFLICT_ACTION: "fail"

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}

Copilot Autofix

AI 4 months ago

In general, the fix is to explicitly declare a permissions block so that the GITHUB_TOKEN has only the scopes required for this job. Since this workflow auto-updates PR branches, it needs to read repository contents and update pull requests (and possibly their branches). A common minimal set is contents: write (to push branch updates) and pull-requests: write (to update PR metadata/status if needed). If you know the action only touches branches and not PR metadata, you could restrict to contents: write, but to avoid breaking existing functionality, we’ll allow both.

The best fix without altering existing behavior is to add a permissions block at the job level for autoupdate. This keeps the change local to this workflow and avoids affecting any other workflows that might exist. Concretely, in .github/workflows/autoupdate.yml, under autoupdate: and aligned with runs-on:, insert:

permissions:
  contents: write
  pull-requests: write

No additional methods, imports, or definitions are needed; this is purely a YAML configuration change.

Suggested changeset 1
.github/workflows/autoupdate.yml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/autoupdate.yml b/.github/workflows/autoupdate.yml
--- a/.github/workflows/autoupdate.yml
+++ b/.github/workflows/autoupdate.yml
@@ -9,6 +9,9 @@
   autoupdate:
     name: autoupdate
     runs-on: ubuntu-22.04
+    permissions:
+      contents: write
+      pull-requests: write
     steps:
       - uses: docker://chinthakagodawita/autoupdate-action:v1
         env:
EOF
@@ -9,6 +9,9 @@
autoupdate:
name: autoupdate
runs-on: ubuntu-22.04
permissions:
contents: write
pull-requests: write
steps:
- uses: docker://chinthakagodawita/autoupdate-action:v1
env:
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Copy Markdown
Collaborator

@RamilCDISC RamilCDISC left a comment

Choose a reason for hiding this comment

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

added as required.

@SFJohnson24 SFJohnson24 merged commit fc23ac1 into main Jan 9, 2026
11 checks passed
@SFJohnson24 SFJohnson24 deleted the rerun branch January 9, 2026 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants