Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ GitHub Workflow에 아래의 내용을 추가합니다.
- name: 👑 Run queensac
uses: reddevilmidzy/queensac@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_app_id: ${{ secrets.QUEENSAC_APP_ID }}
github_app_private_key: ${{ secrets.QUEENSAC_APP_PRIVATE_KEY }}
repo: https://github.com/${{ github.repository }}
```

## Contributing
Expand Down
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ Add the following to your GitHub Workflow:
- name: 👑 Run queensac
uses: reddevilmidzy/queensac@v1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
github_app_id: ${{ secrets.QUEENSAC_APP_ID }}
github_app_private_key: ${{ secrets.QUEENSAC_APP_PRIVATE_KEY }}
repo: https://github.com/${{ github.repository }}
```

## Contributing
Expand Down
56 changes: 56 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: "queensac"
description: "Check GitHub repository links and optionally open PRs to fix them."
author: "reddevilmidzy"
branding:
icon: "link"
color: "purple"
inputs:
repo:
description: "GitHub repository URL to scan (defaults to the workflow repository)."
required: false
branch:
description: "Target branch to check and base branch for the pull request."
required: false
dry-run:
description: "Skip pull request creation and only report results."
default: "false"
required: false
github_app_id:
description: "GitHub App ID to use when creating pull requests."
required: false
github_app_private_key:
description: "GitHub App private key (PEM) to use when creating pull requests."
required: false
runs:
using: "composite"
steps:
- name: Install queensac
shell: bash
run: |
set -eo pipefail
rustup update stable
cargo install --path "${{ github.action_path }}" --force
echo "${HOME}/.cargo/bin" >> "${GITHUB_PATH}"
- name: Run queensac
shell: bash
env:
QUEENSAC_APP_ID: ${{ inputs.github_app_id }}
QUEENSAC_APP_PRIVATE_KEY: ${{ inputs.github_app_private_key }}
run: |
set -eo pipefail

repo_input='${{ inputs.repo }}'
if [ -z "${repo_input}" ]; then
repo_input="https://github.com/${{ github.repository }}"
fi

cmd=(queensac --repo "${repo_input}")

if [ -n "${{ inputs.branch }}" ]; then
cmd+=("--branch" "${{ inputs.branch }}")
fi

if [ "${{ inputs.dry-run }}" = "true" ]; then
cmd+=("--dry-run")
fi
"${cmd[@]}"
10 changes: 5 additions & 5 deletions src/git/pr_generator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ impl GitHubAppConfig {
/// Creates a GitHub App configuration from environment variables.
///
/// # Environment Variables
/// * `GITHUB_APP_ID` - The GitHub App ID
/// * `GITHUB_APP_PRIVATE_KEY` - The GitHub App private key (PEM format)
/// * `QUEENSAC_APP_ID` - The GitHub App ID
/// * `QUEENSAC_APP_PRIVATE_KEY` - The GitHub App private key (PEM format)
pub fn from_env() -> Result<Self, PrError> {
let app_id = read_env_var("GITHUB_APP_ID")?
let app_id = read_env_var("QUEENSAC_APP_ID")?
.parse::<u64>()
.map_err(|e| PrError::Config(format!("Invalid GITHUB_APP_ID: {e}")))?;
.map_err(|e| PrError::Config(format!("Invalid QUEENSAC_APP_ID: {e}")))?;

let private_key = read_env_var("GITHUB_APP_PRIVATE_KEY")?;
let private_key = read_env_var("QUEENSAC_APP_PRIVATE_KEY")?;

Ok(Self {
app_id,
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn main() {
}

let app_config = GitHubAppConfig::from_env().unwrap_or_else(|e| {
error!("GitHub App configuration not found: {}. Please set GITHUB_APP_ID and GITHUB_APP_PRIVATE_KEY environment variables.", e);
error!("GitHub App configuration not found: {}. Please set QUEENSAC_APP_ID and QUEENSAC_APP_PRIVATE_KEY environment variables.", e);
std::process::exit(1);
});

Expand Down