Skip to content

chore: refactor workflows to align with the module template#136

Draft
Mrtenz wants to merge 1 commit into
mainfrom
mrtenz/workflow-refactor
Draft

chore: refactor workflows to align with the module template#136
Mrtenz wants to merge 1 commit into
mainfrom
mrtenz/workflow-refactor

Conversation

@Mrtenz

@Mrtenz Mrtenz commented Jun 15, 2026

Copy link
Copy Markdown
Member

Summary

Adopts the module template's workflow layout, with Action-specific deviations where this repo's nature requires them.

main.yml orchestrator (new)

Runs actionlint (with the .github/actionlint-matcher.json matcher), the MetaMask/action-security-code-scanner reusable workflow, the build-lint-test reusable workflow, and an all-jobs-pass aggregator. On a push to main authored by github-actions, MetaMask/action-is-release@v2 detects whether the commit is a release and, if so, calls the publish-release reusable workflow.

build-lint-test.yml

Converted to workflow_call. Gains a Node 20/22/24 matrix and a clean-working-directory check. The bespoke updated-packages-test job (running scripts/get-release-packages.sh against MetaMask/snaps@v120.0.0) is preserved verbatim, with a corepack enable step added.

publish-release.yml

Converted to workflow_call. New flow:

  1. announce-release — posts a deployment-awaiting message to Slack.
  2. publish-release — checks out at github.sha, runs the action via uses: ./ (we can't reference MetaMask/action-publish-release here because this repo is that action), then updates the shorthand major version tag. The deploy gate uses the action-publish environment.

security-code-scanner.yml retired

Replaced by the analyse-code job in main.yml, which calls MetaMask/action-security-code-scanner/.github/workflows/security-scan.yml@v2 (the module-template pattern).

create-release-pr.yml

Bumps to MetaMask/action-create-release-pr@v5, actions/checkout@v6, actions/setup-node@v6 with node-version-file: '.nvmrc'. Should close the open Dependabot PR for the v5 bump.

Script move

scripts/update-major-version-tag.sh.github/workflows/scripts/update-major-version-tag.sh. It's only used by the publish workflow, so it lives next to it. Picks up the small polish from action-checkout-and-setup: quote the tag name in echo output, drop a trailing space.

Part of an opportunistic module-template sync.

Add main.yml as the orchestrator (actionlint, security scan, build-
lint-test, all-jobs aggregation, action-is-release, publish-release).
Convert build-lint-test and publish-release to workflow_call.
@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

if: inputs.slack-subteam != ''
run: |
DEFAULT_TEXT="\`${{ steps.name-hash.outputs.NAME_VERSION }}\` is awaiting deployment :rocket: \n <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/|→ Click here to review deployment>"
SUBTEAM_TEXT="${{ inputs.slack-subteam }}"
Comment on lines +23 to +61
announce-release:
name: Announce release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- id: name-hash
name: Get Slack name and hash
shell: bash
if: inputs.slack-subteam != ''
run: |
NAME_VERSION_TEXT=$(jq --raw-output '.name + "@" + .version' package.json )
NAME_VERSION_TEXT_STRIPPED="${NAME_VERSION_TEXT#@}"
echo "NAME_VERSION=$NAME_VERSION_TEXT_STRIPPED" >> "$GITHUB_OUTPUT"
- id: final-text
name: Get Slack final text
shell: bash
if: inputs.slack-subteam != ''
run: |
DEFAULT_TEXT="\`${{ steps.name-hash.outputs.NAME_VERSION }}\` is awaiting deployment :rocket: \n <https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}/|→ Click here to review deployment>"
SUBTEAM_TEXT="${{ inputs.slack-subteam }}"
FINAL_TEXT="$DEFAULT_TEXT"
if [[ ! "$SUBTEAM_TEXT" == "" ]]; then
FINAL_TEXT="<!subteam^$SUBTEAM_TEXT> $DEFAULT_TEXT"
fi
echo "FINAL_TEXT=$FINAL_TEXT" >> "$GITHUB_OUTPUT"
- name: Post to a Slack channel
if: inputs.slack-subteam != ''
uses: slackapi/slack-github-action@007b2c3c751a190b6f0f040e47ed024deaa72844
with:
payload: |
{
"text": "${{ steps.final-text.outputs.FINAL_TEXT }}",
"icon_url": "${{ inputs.slack-icon-url }}",
"username": "${{ inputs.slack-username }}"
}
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK
continue-on-error: true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants