Skip to content

Commit

Permalink
Fix all issues found by pre-commit and add a pre-commit check to PRs (#…
Browse files Browse the repository at this point in the history
…1112)

This PR should go in after #955

This PR:
* Fixes all the issues found by the pre-commit hooks (by running
`pre-commit run --all-files`)
* Adds a check on future AL-Go PRs to ensure the pre-commit hooks have
been run.

---------

Co-authored-by: Freddy Kristiansen <[email protected]>
  • Loading branch information
aholstrup1 and freddydk authored Jun 24, 2024
1 parent ae5d800 commit 6f8c7f3
Show file tree
Hide file tree
Showing 147 changed files with 932 additions and 522 deletions.
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ updates:
schedule:
interval: weekly
ignore:
- dependency-name: "microsoft/AL-Go-Actions/*"
- dependency-name: "microsoft/AL-Go-Actions/*"
2 changes: 1 addition & 1 deletion .github/workflows/Deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ on:
description: 'Which version of BcContainerHelper to use? (latest, preview, private, a specific version number or a direct download URL like https://github.com/freddydk/navcontainerhelper/archive/master.zip). Leave empty to use latest (or preview for preview branches)'
required: false
default: 'latest'

permissions:
contents: read
actions: read
Expand Down
17 changes: 17 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: pre-commit

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

jobs:
pre-commit:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
- uses: pre-commit/[email protected]
with:
extra_args: --all-files
2 changes: 1 addition & 1 deletion Actions/AL-Go-Helper.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2367,4 +2367,4 @@ function Get-PackageVersion($PackageName) {
else {
throw "Package $PackageName is not in the list of packages"
}
}
}
6 changes: 5 additions & 1 deletion Actions/AddExistingApp/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Add existing app

Add an existing app to an AL-Go for GitHub repository

## INPUT

### ENV variables

none

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -19,4 +22,5 @@ none
| directCommit | | true if the action should create a direct commit against the branch or false to create a Pull Request | false |

## OUTPUT
none

none
8 changes: 7 additions & 1 deletion Actions/AnalyzeTests/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Analyze Tests

Analyze results of tests from the RunPipeline action

## INPUT

### ENV variables

none

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -16,12 +19,15 @@ none
## OUTPUT

### ENV variables

none

### OUTPUT variables

| Name | Description |
| :-- | :-- |
| TestResultMD | MarkDown of the test result with \n instead of line breaks |
| TestResultMD | MarkDown of the test result with \\n instead of line breaks |

### SUMMARY

This function will set the test result markdown in the GITHUB_STEP_SUMMARY section
2 changes: 1 addition & 1 deletion Actions/BuildPowerPlatform/BuildPowerPlatform.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -271,4 +271,4 @@ if ($environmentName -and $companyId) {
}
else {
Write-Host "Skip Business Central connection settings update since EnvironmentName and CompanyId are not set"
}
}
4 changes: 4 additions & 0 deletions Actions/BuildPowerPlatform/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Build Power Platform

Build the Power Platform solution

## INPUT

### ENV variables

none

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -19,4 +22,5 @@ none
| appRevision | | The app revision number | |

## OUTPUT

none
10 changes: 5 additions & 5 deletions Actions/BuildPowerPlatform/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,12 @@ runs:
- name: Install Power Platform Tools
uses: microsoft/powerplatform-actions/actions-install@v1

- name: Update Power Platform Files
- name: Update Power Platform Files
shell: ${{ inputs.shell }}
env:
_solutionFolder: ${{ inputs.solutionFolder }}
_companyId: ${{ inputs.companyId }}
_environmentName: ${{ inputs.environmentName }}
_environmentName: ${{ inputs.environmentName }}
_appBuild: ${{ inputs.appBuild }}
_appRevision: ${{ inputs.appRevision }}
run: |
Expand All @@ -53,7 +53,7 @@ runs:
catch {
Write-Host "::ERROR::Unexpected error when running action. Error Message: $($_.Exception.Message.Replace("`r",'').Replace("`n",' ')), StackTrace: $($_.ScriptStackTrace.Replace("`r",'').Replace("`n",' <- '))";
exit 1
}
}
- name: Test Pack (Not real - just workaround for https://github.com/microsoft/powerplatform-vscode/issues/412)
uses: microsoft/powerplatform-actions/pack-solution@v1
Expand All @@ -74,7 +74,7 @@ runs:
solution-folder: ${{ inputs.solutionFolder }}
solution-type: "Unmanaged"
process-canvas-apps: true

branding:
icon: terminal
color: blue
color: blue
Original file line number Diff line number Diff line change
Expand Up @@ -295,4 +295,4 @@ function CalculateProjectsAndApps {
}
$allApps
}
}
}
4 changes: 4 additions & 0 deletions Actions/BuildReferenceDocumentation/README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
# BuildReferenceDocumentation

Build documentation using [ALDoc](https://go.microsoft.com/fwlink/?linkid=2247728) and [DocFx](https://dotnet.github.io/docfx)

## INPUT

### ENV variables

| Name | Description |
| :-- | :-- |
| Settings | env.Settings must be set by a prior call to the ReadSettings Action |

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
| token | | The GitHub token running the action | github.token |
| artifacts | Yes | The artifacts to build documentation for or a folder in which the artifacts have been downloaded | |

## OUTPUT

none
5 changes: 5 additions & 0 deletions Actions/CalculateArtifactNames/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# Calculate Artifact Names

Calculate Artifact Names for AL-Go workflows

## INPUT

### ENV variables

| Name | Description |
| :-- | :-- |
| Settings | env.Settings must be set by a prior call to the ReadSettings Action |

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -19,9 +22,11 @@ Calculate Artifact Names for AL-Go workflows
## OUTPUT

### ENV variables

none

### OUTPUT variables

| Name | Description |
| :-- | :-- |
| ThisBuildAppsArtifactsName | Artifact name for apps being built in the current workflow run |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -426,4 +426,4 @@ function UpdateSettingsFile {
}
# Save the file with LF line endings and UTF8 encoding
$settings | Set-JsonContentLF -path $settingsFile
}
}
6 changes: 5 additions & 1 deletion Actions/CheckForUpdates/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Check for updates

Check for updates to AL-Go system files and perform the update if requested

## INPUT

### ENV variables

none

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -19,4 +22,5 @@ none
| directCommit | | True if the action should create a direct commit against the branch or false to create a Pull Request | false |

## OUTPUT
none

none
4 changes: 4 additions & 0 deletions Actions/CreateApp/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Create a new app

Create a new app and add it to an AL-Go repository

## INPUT

### ENV variables

none

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -24,4 +27,5 @@ none
| directCommit | | true if the action should create a direct commit against the branch or false to create a Pull Request | false |

## OUTPUT

none
6 changes: 5 additions & 1 deletion Actions/CreateDevelopmentEnvironment/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Create Development Environment

Create an online development environment

## INPUT

### ENV variables

none

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -21,4 +24,5 @@ none
| directCommit | | true if the action should create a direct commit against the branch or false to create a Pull Request | false |

## OUTPUT
none

none
5 changes: 5 additions & 0 deletions Actions/CreateReleaseNotes/README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Creates release notes

Creates release notes for a release, based on a given tag and the tag from the latest release

## INPUT

### ENV variables

none

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -18,9 +21,11 @@ none
## OUTPUT

### ENV variables

none

### OUTPUT variables

| Name | Description |
| :-- | :-- |
| ReleaseVersion | The release version |
Expand Down
4 changes: 4 additions & 0 deletions Actions/Deliver/README.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
# Deliver

Deliver App to deliveryTarget (AppSource, Storage, or...)

## INPUT

### ENV variables

| Name | Description |
| :-- | :-- |
| Settings | env.Settings must be set by a prior call to the ReadSettings Action |
| Secrets | env.Secrets with delivery target context secrets must be read by a prior call to the ReadSecrets Action |

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -24,4 +27,5 @@ Deliver App to deliveryTarget (AppSource, Storage, or...)
| goLive | | Only relevant for AppSource delivery type. Promote AppSource App to Go Live? | false |

## OUTPUT

none
4 changes: 4 additions & 0 deletions Actions/Deploy/README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,19 @@
# Deploy

Deploy Apps to online environment

## INPUT

### ENV variables

| Name | Description |
| :-- | :-- |
| Settings | env.Settings must be set by a prior call to the ReadSettings Action |
| Secrets | env.Secrets with delivery target context secrets must be read by a prior call to the ReadSecrets Action |
| deviceCode | When deploying to a single environment which doesn't have an AuthContext, we will wait for the user to finalize the deviceflow with this deviceCode |

### Parameters

| Name | Required | Description | Default value |
| :-- | :-: | :-- | :-- |
| shell | | The shell (powershell or pwsh) in which the PowerShell script in this action should run | powershell |
Expand All @@ -21,6 +24,7 @@ Deploy Apps to online environment
| deploymentEnvironmentsJson | Yes | The settings for all Deployment Environments | |

## OUTPUT

| Name | Description |
| :-- | :-- |
| environmentUrl | The URL for the environment. This URL is presented in the Deploy Step in summary under the environment name |
Loading

0 comments on commit 6f8c7f3

Please sign in to comment.