-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathaction.yml
More file actions
88 lines (80 loc) · 3.14 KB
/
action.yml
File metadata and controls
88 lines (80 loc) · 3.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
name: "Importmap Update"
description: "Dependabot-style automated dependency updates for Rails importmap-rails apps."
author: "thoughtbot"
branding:
icon: "package"
color: "red"
inputs:
config-file:
description: "Path to the YAML config inside the consuming repo."
required: false
default: ".github/importmap-updates.yml"
github-token:
description: "Token used by Octokit to list, open, edit, and close PRs."
required: true
base-branch:
description: "Branch to base PRs against."
required: false
default: "main"
dry-run:
description: "When 'true', run end-to-end but skip all side effects (no commits, pushes, or PR operations)."
required: false
default: "false"
author-name:
description: "Git author name for commits."
required: false
default: "github-actions[bot]"
author-email:
description: "Git author email for commits."
required: false
default: "github-actions[bot]@users.noreply.github.com"
rails-root:
description: "Directory containing the Rails app to run against. Useful when the app lives in a subdirectory or for integration testing."
required: false
default: "${{ github.workspace }}"
runs:
using: "composite"
steps:
- id: run-importmaps
name: Find outdated packages
shell: bash
working-directory: ${{ inputs.rails-root }}
run: |
AUDIT_OUTPUT=$(bin/importmap audit 2>&1 || true)
OUTDATED_OUTPUT=$(bin/importmap outdated 2>&1 || true)
echo "## Importmap Update" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Vulnerabilities" >> $GITHUB_STEP_SUMMARY
echo "$AUDIT_OUTPUT" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Outdated packages" >> $GITHUB_STEP_SUMMARY
echo "$OUTDATED_OUTPUT" >> $GITHUB_STEP_SUMMARY
{
echo 'importmap-audit<<IMPORTMAP_AUDIT_OUTPUT'
echo "$AUDIT_OUTPUT"
echo 'IMPORTMAP_AUDIT_OUTPUT'
} >> "$GITHUB_OUTPUT"
{
echo 'importmap-outdated<<IMPORTMAP_OUTDATED_OUTPUT'
echo "$OUTDATED_OUTPUT"
echo 'IMPORTMAP_OUTDATED_OUTPUT'
} >> "$GITHUB_OUTPUT"
- id: run-importmaps-update
name: Run importmap-update
shell: bash
working-directory: ${{ github.action_path }}
env:
BUNDLE_GEMFILE: ${{ github.action_path }}/Gemfile
RAILS_ROOT: ${{ inputs.rails-root }}
GITHUB_TOKEN: ${{ inputs.github-token }}
GITHUB_REPOSITORY: ${{ github.repository }}
INPUT_CONFIG_FILE: ${{ inputs.config-file }}
IMPORTMAP_BASE_BRANCH: ${{ inputs.base-branch }}
IMPORTMAP_DRY_RUN: ${{ inputs.dry-run }}
IMPORTMAP_AUTHOR_NAME: ${{ inputs.author-name }}
IMPORTMAP_AUTHOR_EMAIL: ${{ inputs.author-email }}
IMPORTMAP_OUTDATED_OUTPUT: ${{ steps.run-importmaps.outputs.importmap-outdated }}
IMPORTMAP_AUDIT_OUTPUT: ${{ steps.run-importmaps.outputs.importmap-audit }}
run: |
bundle install
bundle exec exe/importmap-update 2>&1 | tee "${IMPORTMAP_RUN_LOG:-/dev/null}"