mirror of
https://github.com/ivuorinen/actions.git
synced 2026-02-23 03:50:41 +00:00
chore: switch GITHUB_TOKEN to github.token, tweaks
This commit is contained in:
@@ -6,7 +6,7 @@ end_of_line = lf
|
|||||||
indent_size = 2
|
indent_size = 2
|
||||||
indent_style = space
|
indent_style = space
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
max_line_length = 120
|
max_line_length = 200
|
||||||
tab_width = 2
|
tab_width = 2
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
|
||||||
|
|||||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -134,3 +134,4 @@ Homestead.json
|
|||||||
next-env.d.ts
|
next-env.d.ts
|
||||||
|
|
||||||
megalinter-reports/
|
megalinter-reports/
|
||||||
|
./update_*
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"default": true,
|
"default": true,
|
||||||
"MD013": {
|
"MD013": {
|
||||||
"line_length": 120,
|
"line_length": 200,
|
||||||
"code_blocks": false,
|
"code_blocks": false,
|
||||||
"tables": false
|
"tables": false
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
---
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v5.0.0
|
rev: v5.0.0
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ extends: default
|
|||||||
|
|
||||||
rules:
|
rules:
|
||||||
line-length:
|
line-length:
|
||||||
max: 120
|
max: 200
|
||||||
level: warning
|
level: warning
|
||||||
truthy:
|
truthy:
|
||||||
check-keys: false
|
check-keys: false
|
||||||
|
|||||||
@@ -45,12 +45,12 @@ runs:
|
|||||||
- name: Publish Package
|
- name: Publish Package
|
||||||
shell: bash
|
shell: bash
|
||||||
run: dotnet nuget push ./artifacts/*.nupkg \
|
run: dotnet nuget push ./artifacts/*.nupkg \
|
||||||
--api-key ${{ secrets.GITHUB_TOKEN }} \
|
--api-key ${{ github.token }} \
|
||||||
--source "https://nuget.pkg.github.com/${{ inputs.namespace }}/index.json" \
|
--source "https://nuget.pkg.github.com/${{ inputs.namespace }}/index.json" \
|
||||||
--skip-duplicate \
|
--skip-duplicate \
|
||||||
--no-symbols \
|
--no-symbols \
|
||||||
|| (sleep 5 && dotnet nuget push ./artifacts/*.nupkg \
|
|| (sleep 5 && dotnet nuget push ./artifacts/*.nupkg \
|
||||||
--api-key ${{ secrets.GITHUB_TOKEN }} \
|
--api-key ${{ github.token }} \
|
||||||
--source "https://nuget.pkg.github.com/${{ inputs.namespace }}/index.json" \
|
--source "https://nuget.pkg.github.com/${{ inputs.namespace }}/index.json" \
|
||||||
--skip-duplicate \
|
--skip-duplicate \
|
||||||
--no-symbols)
|
--no-symbols)
|
||||||
|
|||||||
@@ -16,7 +16,7 @@ runs:
|
|||||||
- name: Checkout Code
|
- name: Checkout Code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
with:
|
with:
|
||||||
token: ${{ secrets.PAT || secrets.GITHUB_TOKEN }}
|
token: ${{ secrets.PAT || github.token }}
|
||||||
|
|
||||||
# If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to
|
# If you use VALIDATE_ALL_CODEBASE = true, you can remove this line to
|
||||||
# improve performance
|
# improve performance
|
||||||
@@ -54,7 +54,7 @@ runs:
|
|||||||
contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref)
|
contains(fromJSON('["refs/heads/main", "refs/heads/master"]'), github.ref)
|
||||||
}}
|
}}
|
||||||
|
|
||||||
GITHUB_TOKEN: ${{ steps.git-config.outputs.token || secrets.PAT || secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ steps.git-config.outputs.token || secrets.PAT || github.token }}
|
||||||
|
|
||||||
# Apply linter fixes configuration
|
# Apply linter fixes configuration
|
||||||
#
|
#
|
||||||
@@ -123,7 +123,7 @@ runs:
|
|||||||
id: cpr
|
id: cpr
|
||||||
if: env.APPLY_FIXES_IF_PR == 'true'
|
if: env.APPLY_FIXES_IF_PR == 'true'
|
||||||
with:
|
with:
|
||||||
token: ${{ steps.git-config.outputs.token || secrets.PAT || secrets.GITHUB_TOKEN }}
|
token: ${{ steps.git-config.outputs.token || secrets.PAT || github.token }}
|
||||||
commit-message: '[MegaLinter] Apply linters automatic fixes'
|
commit-message: '[MegaLinter] Apply linters automatic fixes'
|
||||||
title: '[MegaLinter] Apply linters automatic fixes'
|
title: '[MegaLinter] Apply linters automatic fixes'
|
||||||
labels: bot
|
labels: bot
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ Creates a release for the current month, incrementing patch number if necessary.
|
|||||||
|
|
||||||
### Inputs
|
### Inputs
|
||||||
|
|
||||||
| name | description | required | default |
|
| name | description | required | default |
|
||||||
| --------- | -------------------------------------------------------- | -------- | ------- |
|
| --------- | -------------------------------------------------------- | -------- | --------------------- |
|
||||||
| `token` | <p>GitHub token with permission to create releases.</p> | `true` | `""` |
|
| `token` | <p>GitHub token with permission to create releases.</p> | `true` | `${{ github.token }}` |
|
||||||
| `dry-run` | <p>Run in dry-run mode without creating the release.</p> | `false` | `false` |
|
| `dry-run` | <p>Run in dry-run mode without creating the release.</p> | `false` | `false` |
|
||||||
| `prefix` | <p>Optional prefix for release tags.</p> | `false` | `""` |
|
| `prefix` | <p>Optional prefix for release tags.</p> | `false` | `""` |
|
||||||
|
|
||||||
### Outputs
|
### Outputs
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ This action is a `composite` action.
|
|||||||
# GitHub token with permission to create releases.
|
# GitHub token with permission to create releases.
|
||||||
#
|
#
|
||||||
# Required: true
|
# Required: true
|
||||||
# Default: ""
|
# Default: ${{ github.token }}
|
||||||
|
|
||||||
dry-run:
|
dry-run:
|
||||||
# Run in dry-run mode without creating the release.
|
# Run in dry-run mode without creating the release.
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ inputs:
|
|||||||
token:
|
token:
|
||||||
description: 'GitHub token with permission to create releases.'
|
description: 'GitHub token with permission to create releases.'
|
||||||
required: true
|
required: true
|
||||||
|
default: '${{ github.token }}'
|
||||||
dry-run:
|
dry-run:
|
||||||
description: 'Run in dry-run mode without creating the release.'
|
description: 'Run in dry-run mode without creating the release.'
|
||||||
required: false
|
required: false
|
||||||
|
|||||||
72
run.sh
72
run.sh
@@ -18,8 +18,8 @@ echo "🚀 Aloitetaan päivitys $(date)"
|
|||||||
|
|
||||||
# Check required tools
|
# Check required tools
|
||||||
for cmd in npx sed find grep; do
|
for cmd in npx sed find grep; do
|
||||||
if ! command -v $cmd &> /dev/null; then
|
if ! command -v $cmd &>/dev/null; then
|
||||||
echo "❌ Error: $cmd not found" | tee -a "$log_file"
|
echo "⚠️ Error: $cmd not found" | tee -a "$log_file"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
@@ -36,44 +36,50 @@ fi
|
|||||||
# Iterate over directories
|
# Iterate over directories
|
||||||
echo "📂 Iterating over directories..."
|
echo "📂 Iterating over directories..."
|
||||||
find . -mindepth 1 -maxdepth 1 -type d | while read -r dir; do
|
find . -mindepth 1 -maxdepth 1 -type d | while read -r dir; do
|
||||||
dir=${dir#./}
|
(
|
||||||
action="./$dir/action.yml"
|
echo "🔍 Found directory: $dir"
|
||||||
|
dir=${dir#./}
|
||||||
|
action="./$dir/action.yml"
|
||||||
|
|
||||||
# if action doesn't exist, skip
|
if [ -f "$action" ]; then
|
||||||
if [ ! -f "$action" ]; then
|
echo "📄 Found action.yml in $dir"
|
||||||
echo "⏩ Skipping $dir - action.yml missing"
|
|
||||||
continue
|
|
||||||
fi
|
|
||||||
|
|
||||||
repo="ivuorinen/actions/$dir"
|
repo="ivuorinen/actions/$dir"
|
||||||
readme="./$dir/README.md"
|
readme="./$dir/README.md"
|
||||||
version=$(grep -E '^# version:' "$action" | cut -d ' ' -f 2)
|
version=$(grep -E '^# version:' "$action" | cut -d ' ' -f 2)
|
||||||
|
|
||||||
# if version doesn't exist, use 'main'
|
# if version doesn't exist, use 'main'
|
||||||
if [ -z "$version" ]; then
|
if [ -z "$version" ]; then
|
||||||
version="main"
|
version="main"
|
||||||
echo "ℹ️ Version not set in $dir/action.yml, using 'main'"
|
echo "ℹ️ Version not set in $dir/action.yml, using 'main'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "📝 Updating $readme..."
|
echo "📝 Updating $readme..."
|
||||||
|
|
||||||
printf "# %s\n\n" "$repo" >"$readme"
|
printf "# %s\n\n" "$repo" >"$readme"
|
||||||
|
|
||||||
echo "📄 Generating action documentation..."
|
echo "📄 Generating action documentation..."
|
||||||
if ! npx --yes action-docs@latest \
|
if ! npx --yes action-docs@latest \
|
||||||
--source="$action" \
|
--source="$action" \
|
||||||
--no-banner \
|
--no-banner \
|
||||||
--include-name-header >>"$readme"; then
|
--include-name-header >>"$readme"; then
|
||||||
echo "⚠️ Warning: action-docs failed in $dir directory" | tee -a "$log_file"
|
echo "⚠️ Warning: action-docs failed in $dir directory" | tee -a "$log_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "🔄 Replacing placeholders in $readme..."
|
echo "🔄 Replacing placeholders in $readme..."
|
||||||
$SED_CMD "s|PROJECT|$repo|g; s|VERSION|$version|g; s|\*\*\*||g" "$readme"
|
$SED_CMD "s|PROJECT|$repo|g; s|VERSION|$version|g; s|\*\*\*||g" "$readme"
|
||||||
|
|
||||||
if [ -f "$readme.bak" ]; then
|
if [ -f "$readme.bak" ]; then
|
||||||
rm "$readme.bak"
|
rm "$readme.bak"
|
||||||
echo "🗑️ Removed $readme.bak"
|
echo "🗑️ Removed $readme.bak"
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
# if action doesn't exist, skip
|
||||||
|
echo "⏩ Skipping $dir - action.yml missing"
|
||||||
|
fi
|
||||||
|
) || {
|
||||||
|
echo "⚠️ Warning: Error processing directory $dir" | tee -a "$log_file"
|
||||||
|
}
|
||||||
done
|
done
|
||||||
echo ""
|
echo ""
|
||||||
|
|
||||||
@@ -105,5 +111,3 @@ if [ -f "$log_file" ]; then
|
|||||||
echo "- Warnings: $warnings"
|
echo "- Warnings: $warnings"
|
||||||
fi
|
fi
|
||||||
echo "- Status: ✅ Ready"
|
echo "- Status: ✅ Ready"
|
||||||
|
|
||||||
echo "✅ Ready!"
|
|
||||||
|
|||||||
@@ -8,11 +8,11 @@ Sets Git configuration for actions.
|
|||||||
|
|
||||||
### Inputs
|
### Inputs
|
||||||
|
|
||||||
| name | description | required | default |
|
| name | description | required | default |
|
||||||
| ---------- | ----------------------------------- | -------- | ----------------------------- |
|
| ---------- | ----------------------------------- | -------- | --------------------------- |
|
||||||
| `token` | <p>GitHub token.</p> | `false` | `${{ secrets.GITHUB_TOKEN }}` |
|
| `token` | <p>GitHub token.</p> | `false` | `${{ github.token }}` |
|
||||||
| `username` | <p>GitHub username for commits.</p> | `false` | `github-actions` |
|
| `username` | <p>GitHub username for commits.</p> | `false` | `github-actions` |
|
||||||
| `email` | <p>GitHub email for commits.</p> | `false` | `github-actions@github.com` |
|
| `email` | <p>GitHub email for commits.</p> | `false` | `github-actions@github.com` |
|
||||||
|
|
||||||
### Outputs
|
### Outputs
|
||||||
|
|
||||||
@@ -35,7 +35,7 @@ This action is a `composite` action.
|
|||||||
# GitHub token.
|
# GitHub token.
|
||||||
#
|
#
|
||||||
# Required: false
|
# Required: false
|
||||||
# Default: ${{ secrets.GITHUB_TOKEN }}
|
# Default: ${{ github.token }}
|
||||||
|
|
||||||
username:
|
username:
|
||||||
# GitHub username for commits.
|
# GitHub username for commits.
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ inputs:
|
|||||||
token:
|
token:
|
||||||
description: 'GitHub token.'
|
description: 'GitHub token.'
|
||||||
required: false
|
required: false
|
||||||
default: '${{ secrets.GITHUB_TOKEN }}'
|
default: '${{ github.token }}'
|
||||||
username:
|
username:
|
||||||
description: 'GitHub username for commits.'
|
description: 'GitHub username for commits.'
|
||||||
default: 'github-actions'
|
default: 'github-actions'
|
||||||
|
|||||||
Reference in New Issue
Block a user