{"meta":{"title":"GitHub Actions helper","intro":"Generate and improve GitHub Actions workflows.","product":"GitHub Copilot","breadcrumbs":[{"href":"/en/copilot","title":"GitHub Copilot"},{"href":"/en/copilot/tutorials","title":"Tutorials"},{"href":"/en/copilot/tutorials/customization-library","title":"Customization library"},{"href":"/en/copilot/tutorials/customization-library/custom-instructions","title":"Custom instructions"},{"href":"/en/copilot/tutorials/customization-library/custom-instructions/github-actions-helper","title":"GitHub Actions helper"}],"documentType":"article"},"body":"# GitHub Actions helper\n\nGenerate and improve GitHub Actions workflows.\n\n> \\[!NOTE]\n>\n> * The examples in this library are intended for inspiration—you are encouraged to adjust them to be more specific to your projects, languages, and team processes.\n> * For community-contributed examples of custom instructions for specific languages and scenarios, see the [Awesome GitHub Copilot Customizations](https://github.com/github/awesome-copilot/blob/main/docs/README.instructions.md) repository.\n> * You can apply custom instructions across different scopes, depending on the platform or IDE where you are creating them. For more information, see \"[About customizing GitHub Copilot responses](/en/copilot/concepts/prompting/response-customization).\"\n\nThe following example shows a path-specific `actions.instructions.md` file that applies only to GitHub Actions workflow files in your repository, using the `applyTo` field. For more information about path-specific instructions files, see [Adding repository custom instructions for GitHub Copilot](/en/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions/add-repository-instructions#creating-path-specific-custom-instructions).\n\n````text copy\n---\napplyTo: \".github/workflows/**/*.yml\"\n---\n\nWhen generating or improving GitHub Actions workflows:\n\n## Security First\n- Use GitHub secrets for sensitive data, never hardcode credentials\n- Pin third-party actions to specific commits by using the SHA value (e.g., `- uses: owner/some-action@a824008085750b8e136effc585c3cd6082bd575f`)\n- Configure minimal permissions for GITHUB_TOKEN required for the workflow\n\n## Performance Essentials\n- Cache dependencies with `actions/cache` or built-in cache options\n- Add `timeout-minutes` to prevent hung workflows\n- Use matrix strategies for multi-environment testing\n\n## Best Practices\n- Use descriptive names for workflows, jobs, and steps\n- Include appropriate triggers: `push`, `pull_request`, `workflow_dispatch`\n- Add `if: always()` for cleanup steps that must run regardless of failure\n\n## Example Pattern\n```yaml\nname: CI\non: [push, pull_request]\n\njobs:\n  test:\n    runs-on: ubuntu-latest\n    timeout-minutes: 10\n    steps:\n      - uses: actions/checkout@v6\n      - uses: actions/setup-node@v7\n        with:\n          node-version: 20\n          cache: npm\n      - run: npm ci\n      - run: npm test\n```\n````\n\n## Further reading\n\n* [About customizing GitHub Copilot responses](/en/copilot/concepts/prompting/response-customization) - Overview of response customization in GitHub Copilot\n* [Add custom instructions for Copilot](/en/copilot/how-tos/copilot-on-github/customize-copilot/add-custom-instructions) - How to configure custom instructions\n* [Awesome GitHub Copilot Customizations](https://github.com/github/awesome-copilot/blob/main/README.md) - Repository of community-contributed custom instructions and other customizations for specific languages and scenarios"}