This guide will help you set up and use the shared GitHub Actions from this repository.
- A GitHub repository where you want to use these workflows
- Appropriate permissions to create workflows in your repository
- For Salesforce Code Analyzer: A Salesforce project with code to analyze
- Go to your repository settings
- Navigate to Actions → General
- Ensure "Allow all actions and reusable workflows" is selected
In your repository, create a new file at .github/workflows/code-analysis.yml
Add the following content to your workflow file:
name: Code Analysis
on:
pull_request:
jobs:
analyze:
uses: <your-org>/shared-github-action/.github/workflows/salesforce-code-analyzer.yml@main
permissions:
pull-requests: write
contents: read
actions: readImportant: Replace <your-org> with your GitHub organization name or username.
Commit the workflow file and push it to your repository. The workflow will run automatically on the next pull request.
If your repository is public, workflows can be used immediately by referencing them.
- Go to repository Settings → Actions → General
- Under "Access", select "Accessible from repositories in the organization"
- Save changes
For private repositories:
- The calling repository must be in the same organization
- Set proper access permissions in repository settings
uses: <your-org>/shared-github-action/.github/workflows/salesforce-code-analyzer.yml@mainPros: Always get the latest features and fixes Cons: Breaking changes may affect your workflows
uses: <your-org>/shared-github-action/.github/workflows/salesforce-code-analyzer.yml@v1.0.0Pros: Stable, predictable behavior Cons: Need to manually update to get new features
uses: <your-org>/shared-github-action/.github/workflows/salesforce-code-analyzer.yml@release/v1Pros: Get patch updates automatically Cons: May include minor breaking changes
To create a versioned release:
git tag -a v1.0.0 -m "Release version 1.0.0"
git push origin v1.0.0For major version tracking, create a moving tag:
git tag -a v1 -m "Version 1.x"
git push origin v1 --forceBefore using a workflow in production:
- Create a test repository
- Add the workflow reference
- Create a test pull request
- Verify the workflow runs correctly
- Check the generated artifacts and outputs
- Verify the repository path is correct
- Check that the workflow file exists at the specified path
- Ensure the branch or tag exists
- Verify repository access settings
- Check that required permissions are granted in the calling workflow
- For organizations, verify the repository is allowed to use actions from other repos
- Check that all required inputs are provided
- Verify the workflow syntax is correct
- Review GitHub Actions logs for specific error messages
For issues or questions:
- Check the README.md for usage examples
- Review workflow logs for error details
- Open an issue in this repository