From 941568f726a5c6d01c70ed01d6c9b1802e2d7831 Mon Sep 17 00:00:00 2001 From: Flavien Darche <11708575+e-n-0@users.noreply.github.com> Date: Fri, 27 Jun 2025 16:20:10 +0200 Subject: [PATCH 1/4] Refine documentation for the proxy sample rate (#53) # Changes Related to the PR https://github.com/DataDog/dd-trace-go/pull/3698, the documentation of the proxy sample rate has been updated. --- appsec/config.go | 1 + 1 file changed, 1 insertion(+) diff --git a/appsec/config.go b/appsec/config.go index 09cbbd4..54cc54f 100644 --- a/appsec/config.go +++ b/appsec/config.go @@ -25,6 +25,7 @@ const ( // Deprecated: a new [APISecConfig.Sampler] is now used instead of this. EnvAPISecSampleRate = "DD_API_SECURITY_REQUEST_SAMPLE_RATE" // EnvAPISecProxySampleRate is the env var used to set the sampling rate of API Security schema extraction for proxies. + // The value represents the number of schemas extracted per minute (samples per minute). EnvAPISecProxySampleRate = "DD_API_SECURITY_PROXY_SAMPLE_RATE" // EnvObfuscatorKey is the env var used to provide the WAF key obfuscation regexp EnvObfuscatorKey = "DD_APPSEC_OBFUSCATION_PARAMETER_KEY_REGEXP" From 3f57bd23d1f8803a55d9ce09e2482730eb279c87 Mon Sep 17 00:00:00 2001 From: "dd-k9-library-go[bot]" <214463715+dd-k9-library-go[bot]@users.noreply.github.com> Date: Thu, 14 Aug 2025 13:53:20 +0000 Subject: [PATCH 2/4] Update embedded AppSec Rules to 1.15.1 (#55) Automatically created by [GitHub Actions](https://github.com/DataDog/appsec-internal-go/actions/runs/16872215336). Co-authored-by: dd-k9-library-go[bot] <214463715+dd-k9-library-go[bot]@users.noreply.github.com> --- appsec/embed.go | 4 +- appsec/rules.json | 363 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 361 insertions(+), 6 deletions(-) diff --git a/appsec/embed.go b/appsec/embed.go index 52cf177..125f298 100644 --- a/appsec/embed.go +++ b/appsec/embed.go @@ -14,7 +14,7 @@ var ( //go:embed rules.json staticRecommendedRules []byte - // StaticRecommendedRules holds the recommended AppSec security rules (v1.14.2) - // Source: https://github.com/DataDog/appsec-event-rules/blob/1.14.2/build/recommended.json + // StaticRecommendedRules holds the recommended AppSec security rules (v1.15.1) + // Source: https://github.com/DataDog/appsec-event-rules/blob/1.15.1/build/recommended.json StaticRecommendedRules = unsafe.String(&staticRecommendedRules[0], len(staticRecommendedRules)) ) diff --git a/appsec/rules.json b/appsec/rules.json index e2216bb..b39992a 100644 --- a/appsec/rules.json +++ b/appsec/rules.json @@ -1,7 +1,7 @@ { "version": "2.2", "metadata": { - "rules_version": "1.14.2" + "rules_version": "1.15.1" }, "rules": [ { @@ -2985,7 +2985,7 @@ "address": "graphql.server.resolver" } ], - "regex": "\\b(?:(?:l(?:(?:utimes|chmod)(?:Sync)?|(?:stat|ink)Sync)|w(?:rite(?:(?:File|v)(?:Sync)?|Sync)|atchFile)|u(?:n(?:watchFile|linkSync)|times(?:Sync)?)|s(?:(?:ymlink|tat)Sync|pawn(?:File|Sync))|ex(?:ec(?:File(?:Sync)?|Sync)|istsSync)|a(?:ppendFile|ccess)(?:Sync)?|(?:Caveat|Inode)s|open(?:dir)?Sync|new\\s+Function|Availability|\\beval)\\s*\\(|m(?:ain(?:Module\\s*(?:\\W*\\s*(?:constructor|require)|\\[)|\\s*(?:\\W*\\s*(?:constructor|require)|\\[))|kd(?:temp(?:Sync)?|irSync)\\s*\\(|odule\\.exports\\s*=)|c(?:(?:(?:h(?:mod|own)|lose)Sync|reate(?:Write|Read)Stream|p(?:Sync)?)\\s*\\(|o(?:nstructor\\s*(?:\\W*\\s*_load|\\[)|pyFile(?:Sync)?\\s*\\())|f(?:(?:(?:s(?:(?:yncS)?|tatS)|datas(?:yncS)?)ync|ch(?:mod|own)(?:Sync)?)\\s*\\(|u(?:nction\\s*\\(\\s*\\)\\s*{|times(?:Sync)?\\s*\\())|r(?:e(?:(?:ad(?:(?:File|link|dir)?Sync|v(?:Sync)?)|nameSync)\\s*\\(|quire\\s*(?:\\W*\\s*main|\\[))|m(?:Sync)?\\s*\\()|process\\s*(?:\\W*\\s*(?:mainModule|binding)|\\[)|t(?:his\\.constructor|runcateSync\\s*\\()|_(?:\\$\\$ND_FUNC\\$\\$_|_js_function)|global\\s*(?:\\W*\\s*process|\\[)|String\\s*\\.\\s*fromCharCode|binding\\s*\\[)", + "regex": "\\b(?:(?:l(?:(?:utimes|chmod)(?:Sync)?|(?:stat|ink)Sync)|w(?:rite(?:(?:File|v)(?:Sync)?|Sync)|atchFile)|u(?:n(?:watchFile|linkSync)|times(?:Sync)?)|s(?:(?:ymlink|tat)Sync|pawn(?:File|Sync))|ex(?:ec(?:File(?:Sync)?|Sync)|istsSync)|a(?:ppendFile|ccess)(?:Sync)?|(?:Caveat|Inode)s|open(?:dir)?Sync|new\\s+Function|Availability|\\beval)\\s*\\(|m(?:ain(?:Module\\s*(?:\\W*\\s*(?:constructor|require)|\\[)|\\s*(?:\\W*\\s*(?:constructor|require)|\\[))|kd(?:temp(?:Sync)?|irSync)\\s*\\(|odule\\.exports\\s*=)|c(?:(?:(?:h(?:mod|own)|lose)Sync|reate(?:Write|Read)Stream|p(?:Sync)?)\\s*\\(|o(?:nstructor\\s*(?:\\W*\\s*_load|\\[)|pyFile(?:Sync)?\\s*\\())|f(?:(?:(?:s(?:(?:yncS)?|tatS)|datas(?:yncS)?)ync|ch(?:mod|own)(?:Sync)?)\\s*\\(|u(?:nction\\s*\\(\\s*\\)\\s*{|times(?:Sync)?\\s*\\())|r(?:e(?:(?:ad(?:(?:File|link|dir)?Sync|v(?:Sync)?)|nameSync)\\s*\\(|quire\\s*(?:\\W*\\s*main\\b|\\[))|m(?:Sync)?\\s*\\()|process\\s*(?:\\W*\\s*(?:mainModule|binding)|\\[)|t(?:his\\.constructor|runcateSync\\s*\\()|_(?:\\$\\$ND_FUNC\\$\\$_|_js_function)|global\\s*(?:\\W*\\s*process|\\[)|String\\s*\\.\\s*fromCharCode|binding\\s*\\[)", "options": { "case_sensitive": true, "min_length": 3 @@ -5539,6 +5539,7 @@ "confidence": "0", "module": "waf" }, + "max_version": "1.24.9", "conditions": [ { "parameters": { @@ -5656,6 +5657,52 @@ ], "transformers": [] }, + { + "id": "dog-932-110", + "name": "Python: Subprocess-based command injection", + "tags": { + "type": "command_injection", + "category": "attack_attempt", + "confidence": "0", + "module": "waf" + }, + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.query" + }, + { + "address": "server.request.body" + }, + { + "address": "server.request.path_params" + }, + { + "address": "server.request.headers.no_cookies" + }, + { + "address": "grpc.server.request.message" + }, + { + "address": "graphql.server.all_resolvers" + }, + { + "address": "graphql.server.resolver" + } + ], + "regex": "(?s)\\bsubprocess\\b.*\\b(?:check_output|run|Popen|call|check_call)\\b", + "options": { + "case_sensitive": true, + "min_length": 14 + } + }, + "operator": "match_regex" + } + ], + "transformers": [] + }, { "id": "dog-934-001", "name": "XXE - XML file loads external entity", @@ -6625,7 +6672,10 @@ { "address": "graphql.server.resolver" } - ] + ], + "options": { + "path-inspection": true + } }, "operator": "ssrf_detector" } @@ -8870,6 +8920,271 @@ "transformers": [] } ], + "rules_compat": [ + { + "id": "api-001-100", + "name": "JWT: No expiry is present", + "tags": { + "type": "jwt", + "category": "api_security", + "confidence": "0", + "module": "business-logic" + }, + "min_version": "1.25.0", + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.jwt", + "key_path": [ + "payload", + "exp" + ] + } + ] + }, + "operator": "!exists" + } + ], + "transformers": [], + "output": { + "event": false, + "keep": false, + "attributes": { + "_dd.appsec.api.jwt.no_expiry": { + "value": 1 + } + } + } + }, + { + "id": "api-001-110", + "name": "JWT: Collect algorithm used", + "tags": { + "type": "jwt", + "category": "api_security", + "confidence": "0", + "module": "business-logic" + }, + "min_version": "1.25.0", + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.jwt", + "key_path": [ + "header", + "alg" + ] + } + ] + }, + "operator": "exists" + } + ], + "transformers": [], + "output": { + "event": false, + "keep": false, + "attributes": { + "_dd.appsec.api.jwt_alg": { + "address": "server.request.jwt", + "key_path": [ + "header", + "alg" + ] + } + } + } + }, + { + "id": "api-001-120", + "name": "JWT: No audience is specified", + "tags": { + "type": "jwt", + "category": "api_security", + "confidence": "0", + "module": "business-logic" + }, + "min_version": "1.25.0", + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.jwt", + "key_path": [ + "payload", + "aud" + ] + } + ] + }, + "operator": "!exists" + } + ], + "transformers": [], + "output": { + "event": false, + "keep": false, + "attributes": { + "_dd.appsec.api.jwt.no_audience": { + "value": 1 + } + } + } + }, + { + "id": "api-001-130", + "name": "JWT: None algorithm used", + "tags": { + "type": "jwt", + "category": "api_security", + "confidence": "0", + "module": "business-logic" + }, + "min_version": "1.25.0", + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.jwt", + "key_path": [ + "header", + "alg" + ] + } + ], + "list": [ + "none", + "nonE", + "noNe", + "noNE", + "nOne", + "nOnE", + "nONe", + "nONE", + "None", + "NonE", + "NoNe", + "NoNE", + "NOne", + "NOnE", + "NONe", + "NONE" + ] + }, + "operator": "exact_match" + } + ], + "transformers": [], + "output": { + "event": false, + "keep": true, + "attributes": { + "_dd.appsec.api.jwt.none_alg": { + "value": 1 + } + } + } + }, + { + "id": "ua0-600-551", + "name": "Datadog test scanner - scalar trace-tagging version: user-agent", + "tags": { + "type": "security_scanner", + "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", + "tool_name": "Datadog Canary Test", + "confidence": "1", + "module": "waf" + }, + "min_version": "1.25.0", + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.headers.no_cookies", + "key_path": [ + "user-agent" + ] + }, + { + "address": "grpc.server.request.metadata", + "key_path": [ + "dd-canary" + ] + } + ], + "regex": "^dd-test-scanner-tag-scalar(?:$|/|\\s)" + }, + "operator": "match_regex" + } + ], + "transformers": [], + "output": { + "event": false, + "attributes": { + "_dd.appsec.test.scanner.scalar": { + "value": 1 + } + } + } + }, + { + "id": "ua0-600-552", + "name": "Datadog test scanner - reference trace-tagging version: user-agent", + "tags": { + "type": "security_scanner", + "category": "attack_attempt", + "cwe": "200", + "capec": "1000/118/169", + "tool_name": "Datadog Canary Test", + "confidence": "1", + "module": "waf" + }, + "min_version": "1.25.0", + "conditions": [ + { + "parameters": { + "inputs": [ + { + "address": "server.request.headers.no_cookies", + "key_path": [ + "user-agent" + ] + }, + { + "address": "grpc.server.request.metadata", + "key_path": [ + "dd-canary" + ] + } + ], + "regex": "^dd-test-scanner-tag-ref(?:$|/|\\s)" + }, + "operator": "match_regex" + } + ], + "transformers": [], + "output": { + "event": false, + "attributes": { + "_dd.appsec.test.scanner.reference": { + "address": "server.request.headers.no_cookies", + "key_path": [ + "user-agent" + ] + } + } + } + } + ], "processors": [ { "id": "http-endpoint-fingerprint", @@ -9074,6 +9389,28 @@ "evaluate": true, "output": true }, + { + "id": "decode-auth-jwt", + "generator": "jwt_decode", + "min_version": "1.25.0", + "parameters": { + "mappings": [ + { + "inputs": [ + { + "address": "server.request.headers.no_cookies", + "key_path": [ + "authorization" + ] + } + ], + "output": "server.request.jwt" + } + ] + }, + "evaluate": true, + "output": false + }, { "id": "http-network-fingerprint", "generator": "http_network_fingerprint", @@ -9918,6 +10255,24 @@ "category": "payment" } }, + { + "id": "c542c147-3883-43d6-a067-178e4a7bd65d", + "name": "Password", + "key": { + "operator": "match_regex", + "parameters": { + "regex": "\\bpass(?:[_-]?word|wd)?\\b|\\bpwd\\b", + "options": { + "case_sensitive": false, + "min_length": 3 + } + } + }, + "tags": { + "type": "password", + "category": "credentials" + } + }, { "id": "18b608bd7a764bff5b2344c0", "name": "Phone number", @@ -10146,4 +10501,4 @@ } } ] -} \ No newline at end of file +} From 5240423413a82951cf1938a08b2e686fce4e18d5 Mon Sep 17 00:00:00 2001 From: "dd-k9-library-go[bot]" <214463715+dd-k9-library-go[bot]@users.noreply.github.com> Date: Mon, 18 Aug 2025 09:26:06 +0000 Subject: [PATCH 3/4] chore: update default ruleset to v1.15.1 (#57) Updated default ruleset to v1.15.1. --------- Co-authored-by: dd-k9-library-go[bot] <214463715+dd-k9-library-go[bot]@users.noreply.github.com> Co-authored-by: Romain Marcadier --- .github/workflows/update-rules.yml | 55 ++++++++++++++++++++++-------- 1 file changed, 41 insertions(+), 14 deletions(-) diff --git a/.github/workflows/update-rules.yml b/.github/workflows/update-rules.yml index 445b5f7..26bb955 100644 --- a/.github/workflows/update-rules.yml +++ b/.github/workflows/update-rules.yml @@ -7,11 +7,15 @@ on: jobs: update: runs-on: ubuntu-latest + name: Get latest ruleset outputs: mutation_happened: ${{ steps.detect.outputs.mutation_happened }} + version: ${{ steps.update.outputs.version }} steps: - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Setup Go + uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 - name: Generate a GitHub token id: generate-token uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 @@ -22,14 +26,19 @@ jobs: repositories: appsec-event-rules permission-contents: read - name: Upgrade AppSec Rules - run: ./_tools/rules-updater/update.sh latest + id: update + run: |- + ./_tools/rules-updater/update.sh latest + VERSION=$(jq -r '.metadata.rules_version' < ./appsec/rules.json) + echo "Ruleset version: ${VERSION}" + echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" env: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - name: Detect Updated Code id: detect run: |- git add . - git diff --staged --patch --exit-code > ${{ runner.temp }}/repo.patch || echo "mutation_happened=true" >> $GITHUB_OUTPUT + git diff --staged --patch --exit-code > ${{ runner.temp }}/repo.patch || echo "mutation_happened=true" >> "${GITHUB_OUTPUT}" - name: Upload Patch if: steps.detect.outputs.mutation_happened uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 @@ -39,6 +48,7 @@ jobs: create-pr: needs: update + name: Create PR runs-on: ubuntu-latest permissions: contents: write @@ -50,7 +60,8 @@ jobs: with: app-id: ${{ vars.DD_K9_LIBRARY_GO_APP_ID }} private-key: ${{ secrets.DD_K9_LIBRARY_GO_APP_PRIVATE_KEY }} - - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + - name: Checkout + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 with: token: ${{ steps.generate-token.outputs.token }} persist-credentials: true @@ -71,15 +82,31 @@ jobs: env: APP_SLUG: ${{ steps.generate-token.outputs.app-slug }} GITHUB_TOKEN: ${{ github.token }} - - name: Push Changes + - name: Create PR Branch + id: create-branch run: |- - git add . - git commit -m "Update embedded AppSec Rules" - git push --force-with-lease origin HEAD:automation/update-appsec-rules - - name: Create Pull Request - run: |- - gh pr create --title "Update embedded AppSec Rules to ${{ steps.apply.outputs.version }}" \ - --body "Automatically created by [GitHub Actions](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})." \ - --base "main" --head "automation/update-appsec-rules" + branch="automation/default-ruleset-update/${VERSION}" + git push --force origin "${{ github.sha }}":"refs/heads/${branch}" + echo "branch=${branch}" >> "${GITHUB_OUTPUT}" + git fetch origin "${branch}" + env: + VERSION: ${{ needs.update.outputs.version }} + - name: Create Commit on PR Branch + uses: planetscale/ghcommit-action@6a383e778f6620afde4bf4b45069d3c6983c1ae2 # v0.2.15 + with: + commit_message: "chore: update default ruleset to v${{ needs.update.outputs.version }}" + branch: ${{ steps.create-branch.outputs.branch }} + repo: ${{ github.repository }} env: GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + - name: Create Pull Request + run: |- + git fetch origin "${{ steps.create-branch.outputs.branch }}" + git reset --hard HEAD + git switch "${{ steps.create-branch.outputs.branch }}" + gh pr create --title "chore: update default ruleset to v${VERSION}" \ + --body "Updated default ruleset to v${VERSION}." \ + --head="${{ steps.create-branch.outputs.branch }}" + env: + GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} + VERSION: ${{ needs.update.outputs.version }} From f9cc78110601e75cd2029f7a26673c2813ed1a30 Mon Sep 17 00:00:00 2001 From: Ramy Elkest <4thkest@gmail.com> Date: Fri, 3 Apr 2026 10:03:57 +0100 Subject: [PATCH 4/4] chore: remove update-rules workflow (repo deprecated) (#72) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Summary This repo is deprecated (last real commit: Aug 2025). Instead of migrating the `update-rules.yml` workflow from `DD_K9_LIBRARY_GO_APP_PRIVATE_KEY` to dd-octo-sts, simply remove the workflow entirely. This eliminates the dependency on the shared secret, which is the goal of the migration effort. ## Changes - Deleted `.github/workflows/update-rules.yml` (scheduled rule updater) ## Notes - The `appsec-internal-go.github.read-rules.sts.yaml` policy in appsec-event-rules (merged in DataDog/appsec-event-rules#281) is now unused but harmless to leave - After merge, the `DD_K9_LIBRARY_GO_APP_PRIVATE_KEY` secret can be removed from this repo's settings 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- Jira: APPSEC-62083 Co-authored-by: Claude Opus 4.6 (1M context) --- .github/workflows/update-rules.yml | 112 ----------------------------- 1 file changed, 112 deletions(-) delete mode 100644 .github/workflows/update-rules.yml diff --git a/.github/workflows/update-rules.yml b/.github/workflows/update-rules.yml deleted file mode 100644 index 26bb955..0000000 --- a/.github/workflows/update-rules.yml +++ /dev/null @@ -1,112 +0,0 @@ -name: Update AppSec Rules -on: - workflow_dispatch: # manually - schedule: - - cron: "0 6 * * 1" # every Monday at 06:00 UTC - -jobs: - update: - runs-on: ubuntu-latest - name: Get latest ruleset - outputs: - mutation_happened: ${{ steps.detect.outputs.mutation_happened }} - version: ${{ steps.update.outputs.version }} - steps: - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - - name: Setup Go - uses: actions/setup-go@f111f3307d8850f501ac008e886eec1fd1932a34 # v5.3.0 - - name: Generate a GitHub token - id: generate-token - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 - with: - app-id: ${{ vars.DD_K9_LIBRARY_GO_APP_ID }} - private-key: ${{ secrets.DD_K9_LIBRARY_GO_APP_PRIVATE_KEY }} - owner: DataDog - repositories: appsec-event-rules - permission-contents: read - - name: Upgrade AppSec Rules - id: update - run: |- - ./_tools/rules-updater/update.sh latest - VERSION=$(jq -r '.metadata.rules_version' < ./appsec/rules.json) - echo "Ruleset version: ${VERSION}" - echo "version=${VERSION}" >> "${GITHUB_OUTPUT}" - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - - name: Detect Updated Code - id: detect - run: |- - git add . - git diff --staged --patch --exit-code > ${{ runner.temp }}/repo.patch || echo "mutation_happened=true" >> "${GITHUB_OUTPUT}" - - name: Upload Patch - if: steps.detect.outputs.mutation_happened - uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0 - with: - name: repo.patch - path: ${{ runner.temp }}/repo.patch - - create-pr: - needs: update - name: Create PR - runs-on: ubuntu-latest - permissions: - contents: write - if: needs.update.outputs.mutation_happened - steps: - - name: Generate a GitHub token - id: generate-token - uses: actions/create-github-app-token@df432ceedc7162793a195dd1713ff69aefc7379e # v2.0.6 - with: - app-id: ${{ vars.DD_K9_LIBRARY_GO_APP_ID }} - private-key: ${{ secrets.DD_K9_LIBRARY_GO_APP_PRIVATE_KEY }} - - name: Checkout - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 - with: - token: ${{ steps.generate-token.outputs.token }} - persist-credentials: true - - name: Download Patch - uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8 - with: - name: repo.patch - path: ${{ runner.temp }} - - name: Apply Patch - id: apply - run: |- - git apply ${{ runner.temp }}/repo.patch - echo "version=$(jq -r '.metadata.rules_version' < ./appsec/rules.json)" >> $GITHUB_OUTPUT - - name: Configure git identity - run: |- - git config user.name "${APP_SLUG}[bot]" - git config user.email "$(gh api "/users/${APP_SLUG}[bot]" | jq .id)+${APP_SLUG}[bot]@users.noreply.github.com" - env: - APP_SLUG: ${{ steps.generate-token.outputs.app-slug }} - GITHUB_TOKEN: ${{ github.token }} - - name: Create PR Branch - id: create-branch - run: |- - branch="automation/default-ruleset-update/${VERSION}" - git push --force origin "${{ github.sha }}":"refs/heads/${branch}" - echo "branch=${branch}" >> "${GITHUB_OUTPUT}" - git fetch origin "${branch}" - env: - VERSION: ${{ needs.update.outputs.version }} - - name: Create Commit on PR Branch - uses: planetscale/ghcommit-action@6a383e778f6620afde4bf4b45069d3c6983c1ae2 # v0.2.15 - with: - commit_message: "chore: update default ruleset to v${{ needs.update.outputs.version }}" - branch: ${{ steps.create-branch.outputs.branch }} - repo: ${{ github.repository }} - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - - name: Create Pull Request - run: |- - git fetch origin "${{ steps.create-branch.outputs.branch }}" - git reset --hard HEAD - git switch "${{ steps.create-branch.outputs.branch }}" - gh pr create --title "chore: update default ruleset to v${VERSION}" \ - --body "Updated default ruleset to v${VERSION}." \ - --head="${{ steps.create-branch.outputs.branch }}" - env: - GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} - VERSION: ${{ needs.update.outputs.version }}