This GitHub Action handles scenarios for missing Code of Conduct or outdated Contributor Covenant version by creating or updating the CODE_OF_CONDUCT.md
file and creating a pull request.
- Checks for missing
CODE_OF_CONDUCT.md
and creates one if absent. - Updates the
CODE_OF_CONDUCT.md
to the latest Contributor Covenant version if outdated. - Creates a pull request for the changes made to the
CODE_OF_CONDUCT.md
.
USER_GITHUB_TOKEN
(required): User GitHub Token for authentication and pushing changes.EVENT_ACTION
(required): Event action that triggered the workflow, used to determine the appropriate response.
- Checkout Repository: The action checks out the repository to get the latest code and context.
- Configure Git User: Sets up the Git user configuration for committing changes.
- Authenticate for Git Operations: Authenticates to GitHub for fetching and pushing branches.
- Create or Switch to Branch: Creates or switches to a branch based on the event action (
no_code_of_conduct
orhandle_contributor_covenant_1_4
). - Add or Update
CODE_OF_CONDUCT.md
: Copies the templateCODE_OF_CONDUCT.md
file to the repository and stages it for commit. - Commit Changes: Commits the changes with an appropriate message based on the event action.
- Push Changes: Pushes the committed changes to the corresponding branch.
- Set Pull Request Environment Variables: Sets environment variables for the pull request title, body, and branch.
- Create Pull Request: Uses the
vsoch/pull-request-action
to create a pull request for the changes.
- Missing Code of Conduct: The action will add a
CODE_OF_CONDUCT.md
file and create a pull request. - Outdated Code of Conduct: The action will update the
CODE_OF_CONDUCT.md
to the latest version and create a pull request.
This action requires the following permissions:
contents: write
issues: write
pull-requests: write
Ensure these permissions are set in your workflow.
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
The CC BY-SA license allows users to distribute, remix, adapt, and build upon the material in any medium or format, so long as attribution is given to the creator. The license allows for commercial use. If you remix, adapt, or build upon the material, you must license the modified material under identical terms.
Created by CobosDS. For any issues or contributions, please open an issue or submit a pull request on the GitHub repository.