Pull Request comment that includes interactive actions shortcuts that enable users to effortlessly execute specific workflows. |
This repository provides a versatile Cloudflare Worker script and GitHub Actions workflows designed to streamline various automation tasks within GitHub repositories. The Cloudflare Worker script can trigger Cypress workflows and Cloudflare Pages deployments, but its adaptability allows it to be used for a wide range of scenarios, which means: feel free to integrate per your needs.
The primary objective of this integration is to eliminate the need for navigating to the GitHub Actions page, manually selecting the desired action, and subsequently triggering it. Instead, the repository's ingenious design facilitates a direct and swift triggering of actions.
The Cloudflare Worker script (worker.js) is designed to offer a comprehensive automation framework:
- Authenticate with the GitHub API using a personal access token.
- Handle incoming requests, making it a versatile tool for different triggers.
- Validate requests based on parameters.
- Fetch pull request details, comments, and other relevant information.
- Update comments with dynamic content, such as Cloudflare Pages deployments and Cypress information
- Deploy the Cloudflare Worker script:
- Sign up for a Cloudflare account and create a new Worker.
- Copy the contents of worker.js into the Worker editor.
- Modify constants and functions to match your specific requirements.
- Set up environment variables:
- Make sure to set up your worker's variables (GHA_TOKEN, FOUND_STATUS_CODE, and others).
- In case you're building something different, feel free to customize these variables to tailor the Worker to your use case.
- Deploy the Cloudflare Worker and note the provided URL.
The primary function of the workflow is to create the initial comment when a pull request is first opened. This comment serves as a central hub for information related to the pull request, including Cloudflare Pages deployments and Cypress test run links.
Adapt workflows to your needs:
- Customize environment variables like CF_PAGES_WORKFLOW_BASE_URL and CYPRESS_WORKFLOW_BASE_URL.
This automation framework's adaptability extends beyond the initial comment creation. The versatile architecture can be easily customized for various use cases. You can modify the provided scripts, adapt workflows, and configure environment variables to match your project's unique needs.
Contributions are highly encouraged! Feel free to open issues for questions, suggestions, or bug reports. Pull requests that enhance or extend the capabilities of this automation framework are welcome.
This project is licensed under the MIT License.