Skip to content
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ indent_size = 2
end_of_line = lf

[*.sh]
indent_style = space
indent_size = 4
indent_style = tab
end_of_line = lf
switch_case_indent = true # like -ci
space_redirects = true # like -sr
Expand Down
10 changes: 10 additions & 0 deletions .github/sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
group:
- files:
- source: .apps/
dest: .apps/
- source: docs/apps/
dest: docs/apps/
repos:
- GhostWriters/DockSTARTer-Templates
options:
COMMIT_AS_PR: false
26 changes: 26 additions & 0 deletions .github/workflows/sync_templates.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Sync to Templates

on:
push:
branches:
- main
- master
paths:
- ".apps/**"
- "docs/apps/**"
workflow_dispatch:

jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Sync Files
uses: BetaHuhn/repo-file-sync-action@v1

Check warning

Code scanning / CodeQL

Unpinned tag for a non-immutable Action in workflow Medium

Unpinned 3rd party Action 'Sync to Templates' step
Uses Step
uses 'BetaHuhn/repo-file-sync-action' with ref 'v1', not a pinned commit hash
with:
GH_PAT: ${{ secrets.GH_PAT }}
CONFIG_PATH: .github/sync.yml
PR_LABELS: sync
COMMIT_PREFIX: "chore: sync from DockSTARTer"
Comment on lines +15 to +26

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: {contents: read}

Copilot Autofix

AI 2 months ago

In general, fix this by adding a permissions: block that explicitly restricts the default GITHUB_TOKEN permissions to the minimal scopes needed. This can be done at the workflow root (applies to all jobs without their own permissions) or at the job level. Since there is only one job (sync), adding permissions: under that job is clear and localized.

The BetaHuhn/repo-file-sync-action typically needs to push changes and/or open PRs in target repositories. That requires at least contents: write and pull-requests: write on GITHUB_TOKEN if it uses that token. However, this workflow passes a PAT via GH_PAT, which the action uses for cross‑repo operations. The GITHUB_TOKEN is still used implicitly by Actions for some operations (e.g., commenting on PRs in this repo, if configured). To remain safe while preserving functionality, we can grant contents: read globally and only what’s obviously needed as write. For a conservative, least‑privilege configuration that still supports repo‑file‑sync’s typical workflow of creating commits and PRs, define:

permissions:
  contents: write
  pull-requests: write

Insert this under jobs: sync: on line 15, just before runs-on. No imports or external definitions are needed—only the YAML change in .github/workflows/sync_templates.yml.

Suggested changeset 1
.github/workflows/sync_templates.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/sync_templates.yml b/.github/workflows/sync_templates.yml
--- a/.github/workflows/sync_templates.yml
+++ b/.github/workflows/sync_templates.yml
@@ -12,6 +12,9 @@
 
 jobs:
   sync:
+    permissions:
+      contents: write
+      pull-requests: write
     runs-on: ubuntu-latest
     steps:
       - name: Checkout
EOF
@@ -12,6 +12,9 @@

jobs:
sync:
permissions:
contents: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout
Copilot is powered by AI and may make mistakes. Always verify output.
Loading