Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync from develop to main #11

Merged
merged 14 commits into from
Aug 13, 2024
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
3 changes: 3 additions & 0 deletions .github/CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
This project adheres to **No Code of Conduct**. We are all adults. We accept anyone's contributions. Nothing else matters.

For more information please visit the [No Code of Conduct](https://github.com/domgetter/NCoC) homepage.
11 changes: 11 additions & 0 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
github: [{username}]
community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry
issuehunt: # Replace with a single IssueHunt username
ko_fi: # Replace with a single ko_fi username
liberapay: # Replace with a single Liberapay username
open_collective: # Replace with a single open_collective username
patreon: # Replace with a single Patreon username
tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel
polar: # Replace with a single polar username
buy_me_a_coffee: # Replace with a single buy_me_a_coffee username
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
11 changes: 6 additions & 5 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,21 +42,22 @@ body:

- type: dropdown
attributes:
label: SO version
label: OS version
options:
- Windows 11
- Windows 10
- Windows 8
- Windows 7
- Other
- Windows Other
- Linux Debian
- Linux Arch
- Linux Other
validations:
required: true

- type: checkboxes
attributes:
label: Confirmation
options:
- label: I performed a [search of the issue tracker](https://github.com/segocode/DebloBat/issues) to avoid opening a duplicate issue
- label: I performed a [search of the issue tracker](https://github.com/{username}/{reponame}/issues) to avoid opening a duplicate issue
required: true
- label: I understand that not filling out this template correctly may lead to the issue being closed
required: true
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Contact the developer
url: https://segocode.github.io/SegoCode/
url: https://{username}.github.io/{username}/
about: To discuss any type of related topic
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ body:
attributes:
label: Confirmation
options:
- label: I performed a [search of the feature requests](https://github.com/segocode/DebloBat/issues) to avoid suggesting a duplicate feature
- label: I performed a [search of the feature requests](https://github.com/{username}/{reponame}/issues) to avoid suggesting a duplicate feature
required: true
- label: I understand that not filling out this template correctly may lead to the request being closed
required: true
required: true
5 changes: 1 addition & 4 deletions .github/SECURITY.md
Original file line number Diff line number Diff line change
@@ -1,4 +1 @@
## Security Policy

### Reporting a Vulnerability
If you discover a vulnerability in this application, that poses a significant threat to the security of the users, we recommend that you do not open a public issue. Instead, please send your report via [email](https://segocode.github.io/SegoCode/). Include as much detailed information as possible to help understand the nature of the vulnerability.
If you discover a vulnerability in this application, that poses a significant threat to the security of the users, we recommend that you do not open a public issue. Instead, please send your report via [email](https://{username}.github.io/{username}/). Include as much detailed information as possible to help understand the nature of the vulnerability.
94 changes: 94 additions & 0 deletions .github/workflows/generate-tag.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Generate tag

on:
pull_request:
types: [closed]

jobs:
create_tag:
if: github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'auto-tag')
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up git
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"

- name: Fetch all tags
run: git fetch --tags

- name: Get latest tag
id: get_latest_tag
run: |
# Get the latest tag
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || echo "")
echo "latest_tag=$latest_tag" >> $GITHUB_ENV

- name: Determine new version
id: determine_version
run: |
latest_tag=${{ env.latest_tag }}
if [ -z "$latest_tag" ]; then
# Initialize the version to 1.0 if no tags exist
new_version="1.0"
else
# Extract the major and minor version and increment the minor version
major_version=$(echo $latest_tag | cut -d. -f1)
minor_version=$(echo $latest_tag | cut -d. -f2)
new_minor_version=$((minor_version + 1))
new_version="$major_version.$new_minor_version"

# Check if the new version tag already exists
while git rev-parse "refs/tags/$new_version" >/dev/null 2>&1; do
new_minor_version=$((new_minor_version + 1))
new_version="$major_version.$new_minor_version"
done
fi
echo "new_version=$new_version" >> $GITHUB_ENV

- name: Checkout main branch
run: |
git checkout main

- name: Create new tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
new_version=${{ env.new_version }}
git tag -a $new_version -m "Automatically generated version $new_version"
git push origin $new_version

create_issue:
needs: tag_version
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up git
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"

- name: Fetch all tags
run: git fetch --tags

- name: Get the latest tag
id: get_latest_tag
run: |
# Get the latest tag
latest_tag=$(git describe --tags `git rev-list --tags --max-count=1` 2>/dev/null || echo "")
echo "latest_tag=$latest_tag" >> $GITHUB_ENV

- name: Create issue for new tag
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
latest_tag: ${{ env.latest_tag }}
run: |
repository=${{ github.repository }}
issue_title="The tag \`${{ env.latest_tag }}\` was created"
issue_body=$'The **${{ env.latest_tag }}** tag for the **main branch** has been created. Please consider creating a release of this tag, if a release isn\'t needed, you can close this issue.\n\n[Click here to create a release of **${{ env.latest_tag }}** tag](../releases/new?tag=${{ env.latest_tag }})'
gh issue create --title "$issue_title" --body "$issue_body" --label "auto-tag"
15 changes: 15 additions & 0 deletions .github/workflows/gitleaks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Gitleaks
on: [pull_request, push, workflow_dispatch]
jobs:
scan:
name: gitleaks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Run Gitleaks
uses: gitleaks/gitleaks-action@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
5 changes: 3 additions & 2 deletions .github/workflows/greetings.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Greetings

on: [pull_request_target]
on: [pull_request_target, issues]

jobs:
greeting:
Expand All @@ -12,4 +12,5 @@ jobs:
- uses: actions/first-interaction@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
pr-message: "🎉 Thank you for your first pull request to the repository! We're grateful for your contribution and will review it ASAP."
issue-message: "Thank you for your first issue. To better understand your request or the problem you've encountered, please provide as many details as possible. If the behavior changes or if you have new information about your request, don't hesitate to add it. It will be reviewed ASAP."
pr-message: "Thank you for your first pull request to the repository! We're grateful for your contribution and will review it ASAP."
71 changes: 71 additions & 0 deletions .github/workflows/initializer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Initialize repository

on:
workflow_dispatch:

jobs:
initialize_repo:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
ref: main
fetch-depth: 0

- name: Setup git
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"

- name: Install GitHub CLI
run: |
sudo apt-get update
sudo apt-get install gh -y

- name: Extract repository and username
id: extract
run: |
REPO_NAME="${{ github.repository }}"
USERNAME=$(echo $REPO_NAME | cut -d'/' -f1)
REPO_NAME_ONLY=$(echo $REPO_NAME | cut -d'/' -f2)
echo "::set-output name=username::$USERNAME"
echo "::set-output name=reponame::$REPO_NAME_ONLY"

- name: Set branch name
id: vars
run: echo "::set-output name=branch::initialize-repo-$(date +%Y%m%d%H%M%S)"

- name: Replace {reponame} and {username} with actual values
run: |
REPO_NAME_ONLY="${{ steps.extract.outputs.reponame }}"
USERNAME="${{ steps.extract.outputs.username }}"
REPO_NAME_ESCAPED=$(echo $REPO_NAME_ONLY | sed 's/\//\\\//g')
USERNAME_ESCAPED=$(echo $USERNAME | sed 's/\//\\\//g')
find . -type f -exec sed -i "s/{reponame}/$REPO_NAME_ESCAPED/g" {} +
find . -type f -exec sed -i "s/{username}/$USERNAME_ESCAPED/g" {} +

- name: Remove initializer workflow
run: |
rm -f .github/workflows/initializer.yml

- name: Commit changes
run: |
BRANCH_NAME="${{ steps.vars.outputs.branch }}"
git checkout -b $BRANCH_NAME
git add .
git commit -m "Initialize repository with repo name $REPO_NAME_ONLY and username $USERNAME"
git push origin HEAD:$BRANCH_NAME

- name: Create pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
BRANCH_NAME="${{ steps.vars.outputs.branch }}"
PR_URL=$(gh pr create --base main --head $BRANCH_NAME --title "Initialize repository" --body "This PR initializes the repository with the actual repository name, with the actual username and removing the initializer workflow.")

# Extract PR number from URL
PR_NUMBER=$(basename $PR_URL)

# Add any desired labels to the pull request
# gh pr edit $PR_NUMBER --add-label "initialization"
52 changes: 52 additions & 0 deletions .github/workflows/sync-from-develop-to-main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: Sync from develop to main

on:
workflow_dispatch:

jobs:
create_pr:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Setup git
run: |
git config --global user.name "github-actions"
git config --global user.email "[email protected]"

- name: Install GitHub CLI
run: |
sudo apt-get update
sudo apt-get install gh -y

- name: Check and create labels
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Check if the 'auto-sync' label exists
AUTO_SYNC_LABEL=$(gh api repos/${{ github.repository }}/labels --jq '.[] | select(.name=="auto-sync")')
if [ -z "$AUTO_SYNC_LABEL" ]; then
# Create the 'auto-sync' label if it doesn't exist
gh api repos/${{ github.repository }}/labels -f name='auto-sync' -f color='C5DEF5'
fi

# Check if the 'auto-tag' label exists
AUTO_TAG_LABEL=$(gh api repos/${{ github.repository }}/labels --jq '.[] | select(.name=="auto-tag")')
if [ -z "$AUTO_TAG_LABEL" ]; then
# Create the 'auto-tag' label if it doesn't exist
gh api repos/${{ github.repository }}/labels -f name='auto-tag' -f color='BFDADC'
fi

- name: Create pull request
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
# Create the pull request
PR_URL=$(gh pr create --base main --head develop --title "Sync from develop to main" --body $'This is an automated pull request to sync changes from the develop branch to the main branch. \n >[!WARNING]\n> If this pull request is merged with the \'**auto-tag**\' label, it will create a **new tag**. To prevent this, manually remove the \'**auto-tag**\' label.')

# Extract PR number from URL
PR_NUMBER=$(basename $PR_URL)

# Add the labels to the pull request
gh pr edit $PR_NUMBER --add-label "auto-sync" --add-label "auto-tag"
Loading