Skip to content

Commit 1c10977

Browse files
vaindclaude
andauthored
chore: Use updater action to manage Danger JS version (#131)
* feat(danger): Use updater action to manage Danger JS version Extract the Danger JS version to a properties file and use the updater action to automatically check for and update to new versions. Changes: - Extract version to danger/danger.properties - Read version from properties file in danger action - Add workflow to automatically update Danger JS weekly 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> * chore: Remove unnecessary whitespace in danger.properties --------- Co-authored-by: Claude <[email protected]>
1 parent 3182dd4 commit 1c10977

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

.github/workflows/update-deps.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Update Danger JS
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run weekly on Mondays at 8:00 UTC
7+
- cron: '0 8 * * 1'
8+
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
13+
jobs:
14+
danger:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: getsentry/github-workflows/updater@main
18+
with:
19+
path: danger/danger.properties
20+
name: Danger JS
21+
api-token: ${{ secrets.GITHUB_TOKEN }}

danger/action.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,12 @@ runs:
2222
token: ${{ inputs.api-token }}
2323
fetch-depth: 0
2424

25+
# Read the Danger version from the properties file
26+
- name: Get Danger version
27+
id: config
28+
shell: pwsh
29+
run: Get-Content '${{ github.action_path }}/danger.properties' | Tee-Object $env:GITHUB_OUTPUT -Append
30+
2531
# Using a pre-built docker image in GitHub container registry instead of NPM to reduce possible attack vectors.
2632
- name: Run DangerJS
2733
id: danger
@@ -36,5 +42,5 @@ runs:
3642
-e "INPUT_ARGS" -e "GITHUB_JOB" -e "GITHUB_REF" -e "GITHUB_SHA" -e "GITHUB_REPOSITORY" -e "GITHUB_REPOSITORY_OWNER" -e "GITHUB_RUN_ID" -e "GITHUB_RUN_NUMBER" -e "GITHUB_RETENTION_DAYS" -e "GITHUB_RUN_ATTEMPT" -e "GITHUB_ACTOR" -e "GITHUB_TRIGGERING_ACTOR" -e "GITHUB_WORKFLOW" -e "GITHUB_HEAD_REF" -e "GITHUB_BASE_REF" -e "GITHUB_EVENT_NAME" -e "GITHUB_SERVER_URL" -e "GITHUB_API_URL" -e "GITHUB_GRAPHQL_URL" -e "GITHUB_REF_NAME" -e "GITHUB_REF_PROTECTED" -e "GITHUB_REF_TYPE" -e "GITHUB_WORKSPACE" -e "GITHUB_ACTION" -e "GITHUB_EVENT_PATH" -e "GITHUB_ACTION_REPOSITORY" -e "GITHUB_ACTION_REF" -e "GITHUB_PATH" -e "GITHUB_ENV" -e "GITHUB_STEP_SUMMARY" -e "RUNNER_OS" -e "RUNNER_ARCH" -e "RUNNER_NAME" -e "RUNNER_TOOL_CACHE" -e "RUNNER_TEMP" -e "RUNNER_WORKSPACE" -e "ACTIONS_RUNTIME_URL" -e "ACTIONS_RUNTIME_TOKEN" -e "ACTIONS_CACHE_URL" -e GITHUB_ACTIONS=true -e CI=true \
3743
-e GITHUB_TOKEN="${{ inputs.api-token }}" \
3844
-e DANGER_DISABLE_TRANSPILATION="true" \
39-
ghcr.io/danger/danger-js:11.3.1 \
40-
--failOnErrors --dangerfile ${{ github.action_path }}/dangerfile.js
45+
ghcr.io/danger/danger-js:${{ steps.config.outputs.version }} \
46+
--failOnErrors --dangerfile ${{ github.action_path }}/dangerfile.js

danger/danger.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
version=11.3.1
2+
repo=https://github.com/danger/danger-js

0 commit comments

Comments
 (0)