Skip to content

Commit f68f336

Browse files
authored
fix(ci): fix examples workflow layer injection, permissions, and deno setup (#650)
1 parent 611a73c commit f68f336

1 file changed

Lines changed: 16 additions & 23 deletions

File tree

.github/workflows/examples.yaml

Lines changed: 16 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -213,29 +213,22 @@ jobs:
213213
cp /tmp/layer-x86_64/lambda-adapter "$LAYER_DIR/extensions/"
214214
chmod +x "$LAYER_DIR/bootstrap" "$LAYER_DIR/extensions/lambda-adapter"
215215
# Add local layer resource and replace remote layer ARN refs
216-
python3 -c "
217-
import yaml
218-
with open('.aws-sam/build/template.yaml') as f:
219-
t = yaml.safe_load(f)
220-
t['Resources']['LocalAdapterLayer'] = {
221-
'Type': 'AWS::Lambda::LayerVersion',
222-
'Properties': {
223-
'Content': 'LocalAdapterLayer',
224-
'LayerName': 'local-adapter'
225-
}
226-
}
227-
for r in t.get('Resources', {}).values():
228-
layers = r.get('Properties', {}).get('Layers', [])
229-
for i, l in enumerate(layers):
230-
if isinstance(l, dict):
231-
v = l.get('Fn::Sub', '')
232-
else:
233-
v = l
234-
if 'LambdaAdapterLayerX86' in str(v):
235-
layers[i] = {'Ref': 'LocalAdapterLayer'}
236-
with open('.aws-sam/build/template.yaml', 'w') as f:
237-
yaml.dump(t, f)
238-
"
216+
python3 << 'PYEOF'
217+
import yaml
218+
with open(".aws-sam/build/template.yaml") as f:
219+
t = yaml.safe_load(f)
220+
t["Resources"]["LocalAdapterLayer"] = {
221+
"Type": "AWS::Lambda::LayerVersion",
222+
"Properties": {"Content": "LocalAdapterLayer", "LayerName": "local-adapter"},
223+
}
224+
for r in t.get("Resources", {}).values():
225+
layers = r.get("Properties", {}).get("Layers", [])
226+
for i, l in enumerate(layers):
227+
if "LambdaAdapterLayerX86" in str(l):
228+
layers[i] = {"Ref": "LocalAdapterLayer"}
229+
with open(".aws-sam/build/template.yaml", "w") as f:
230+
yaml.dump(t, f)
231+
PYEOF
239232
240233
- name: Start local API and verify
241234
working-directory: examples/${{ matrix.example }}

0 commit comments

Comments
 (0)