sf-plugin-permission-sets 0.0.0-dev.48 → 0.0.0-dev.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +54 -0
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -16,6 +16,7 @@ Stop clicking through Setup to grant access. Commit a YAML file, open a PR, let
16
16
  - [Why](#why)
17
17
  - [Install](#install)
18
18
  - [Quick start](#quick-start)
19
+ - [GitHub Actions](#github-actions)
19
20
  - [Permission files](#permission-files)
20
21
  - [Organizing files](#organizing-files)
21
22
  - [Modes](#modes)
@@ -77,6 +78,59 @@ sf ps apply --file "./permissions/*.yml" --target-org dev
77
78
  sf ps apply --file "./permissions/*.yml" --target-org prod --mode sync
78
79
  ```
79
80
 
81
+ ## GitHub Actions
82
+
83
+ Two dead-simple workflows: check every pull request with no org, then apply on merge.
84
+
85
+ **1. Check on every pull request** (no org, no secrets):
86
+
87
+ ```yaml
88
+ # .github/workflows/permissions-check.yml
89
+ name: permissions-check
90
+ on: pull_request
91
+ jobs:
92
+ check:
93
+ runs-on: ubuntu-latest
94
+ steps:
95
+ - uses: actions/checkout@v4
96
+ - uses: actions/setup-node@v4
97
+ with:
98
+ node-version: 20
99
+ - run: npm install --global @salesforce/cli
100
+ - run: sf plugins install sf-plugin-permission-sets
101
+ - run: sf ps check --file "permissions/*.yml"
102
+ ```
103
+
104
+ **2. Apply on merge to main** (needs org auth):
105
+
106
+ ```yaml
107
+ # .github/workflows/permissions-apply.yml
108
+ name: permissions-apply
109
+ on:
110
+ push:
111
+ branches: [main]
112
+ paths: ["permissions/**"]
113
+ jobs:
114
+ apply:
115
+ runs-on: ubuntu-latest
116
+ steps:
117
+ - uses: actions/checkout@v4
118
+ - uses: actions/setup-node@v4
119
+ with:
120
+ node-version: 20
121
+ - run: npm install --global @salesforce/cli
122
+ - run: sf plugins install sf-plugin-permission-sets
123
+ # Authenticate to the org from a stored auth URL.
124
+ - run: echo '${{ secrets.SF_AUTH_URL }}' > auth.txt
125
+ - run: sf org login sfdx-url --sfdx-url-file auth.txt --alias prod
126
+ # --no-prompt so a deletion never blocks on a confirmation in CI.
127
+ - run: sf ps apply --file "permissions/*.yml" --target-org prod --mode sync --no-prompt
128
+ ```
129
+
130
+ Get the auth URL once with `sf org display --verbose --target-org prod`, copy the `Sfdx Auth Url` value, and save it as a repository secret named `SF_AUTH_URL`.
131
+
132
+ Want the diff on the PR before merging? Add a `sf ps plan --file "permissions/*.yml" --target-org prod` step (it needs the same org auth) to the check workflow.
133
+
80
134
  ## Permission files
81
135
 
82
136
  `check`, `validate`, `plan`, and `apply` read one or more YAML files with `--file` (alias `-f`). (`export` writes YAML rather than reading it, so there `-f` is the output file.)
package/package.json CHANGED
@@ -122,5 +122,5 @@
122
122
  "exports": "./lib/index.js",
123
123
  "type": "module",
124
124
  "author": "Isaac Ferreira",
125
- "version": "0.0.0-dev.48"
125
+ "version": "0.0.0-dev.49"
126
126
  }