Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/contributor-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Readme Generator - Contributors

on:
schedule:
- cron: "*/120 * * * *"
- cron: "0 */2 * * *"
workflow_dispatch:

permissions:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/contributors-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

- name: Generating
run: |
FOLDER="contributors/names"
FOLDER="util/names"
OUTPUT_FILE="util/contributors.json"

echo "[" > "$OUTPUT_FILE"
Expand Down
115 changes: 17 additions & 98 deletions .github/workflows/merger.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,119 +2,38 @@ name: CI Contributor Merger

on:
pull_request:
types: [closed]
branches: [main]
paths:
- "contributors/*.json"
types: [ labeled ]

concurrency:
group: ${{ github.ref }}-ci-merger
cancel-in-progress: true
group: ${{ github.ref }}-ci-merger
cancel-in-progress: true

jobs:
toMerge:

merger:
runs-on: ubuntu-latest
name: Ready to Merge - ${{ github.event.pull_request.title }}
if: contains( github.event.pull_request.labels.*.name, 'ready to merge')
if: ${{ github.event.pull_request.merged == true }}
permissions: write-all
outputs:
new_user: ${{steps.old_ref.outputs.NEW_NAME}}
current_pr_user: ${{steps.fetched_data.outputs.PR_AUTHOR}}
steps:
- uses: actions/checkout@v4
- name: getting prs
id: get_pr
uses: tj-actions/changed-files@v46

- name: Fetch data
id: fetched_data
- name: Get changed files
id: files
run: |
echo "PR_AUTHOR=${{ github.event.pull_request.user.login }}" >> "$GITHUB_OUTPUT"
echo "CHANGED_FILES=$(gh pr view ${{ github.event.pull_request.number }} --json files --jq '[.files[].status]')" >> $GITHUB_ENV

- name: Fetch data from the main branch
uses: actions/checkout@v4
with:
ref: 'main'

- name: get old display_float_text
id: old_ref
- name: Post merge comment
run: |
name=${{steps.fetched_data.outputs.PR_AUTHOR}}
new_name="$(cat ${{steps.get_pr.outputs.all_changed_files}} | jq -r '.display_float_text')"
if [ $new_name == '' ]; then
new_name+="$name"
fi
echo "NEW_NAME=$new_name" >> "$GITHUB_OUTPUT"

# REMOVING
Delete_Merge:
permissions: write-all
runs-on: ubuntu-latest
needs: toMerge
if: contains( github.event.pull_request.labels.*.name, 'to Delete')
steps:
- uses: thollander/actions-comment-pull-request@v3
with:
message: |
Hey @${{needs.toMerge.outputs.current_pr_user}}! I just wanted to say a big thank you for the effort you put into your contribution. Even though you decided to remove your contribution, we truly appreciate the thought and hard work behind it. Every bit of collaboration counts, and we're glad to have you on board!

Best Regards,
@STICKnoLOGIC
github-token: ${{ secrets.FA_TOKEN }}
- uses: "pascalgn/[email protected]"
env:
GITHUB_TOKEN: ${{ secrets.FA_TOKEN }}
MERGE_LABELS: "ready to merge"
MERGE_REMOVE_LABELS: "ready to merge"

# ADDING
Create_Merge:
runs-on: ubuntu-latest
permissions: write-all
needs: toMerge
if: ${{ github.event.pull_request && !contains(github.event.pull_request.labels.*.name, 'to Delete') }}
steps:
- uses: actions/checkout@v4
with:
ref: 'main'
token: ${{ secrets.FA_TOKEN }}
- name: Fetching Data
run: |
mkdir -p contributors/names/
floatName="${{needs.toMerge.outputs.new_user}}"
oldName=""
name=${{needs.toMerge.outputs.current_pr_user}}
content="contributors/${name,,}.json"
old_user="$(cat $content | jq -r '.display_float_text')"
if [ $floatName == '' && $old_user != ${{needs.toMerge.outputs.current_pr_user}} ]; then
echo "${{needs.toMerge.outputs.current_pr_user}}" > contributors/names/@${{needs.toMerge.outputs.current_pr_user}}
elif [ $floatName != '' && $floatName != $$old_user ]; then
echo "$floatName" > contributors/names/@${{needs.toMerge.outputs.current_pr_user}}
fi
git config --global user.name 'STICKnoLOGIC'
git config --global user.email '[email protected]'
git add ./contributors/names
if git commit -m 'Update Contributor/s'; then
echo 'commited'
fi
if git push ; then
echo 'pushed'
fi

- uses: thollander/actions-comment-pull-request@v3
with:
message: |
Hi @${{needs.toMerge.outputs.current_pr_user}}!
Every great journey begins with a first step. Your first contribution on `First Accord` shows just how capable you are. Keep building your skills and gently nurturing your confidence — check out [these additional resources](https://github.com/firstcontributions/first-contributions) to get you adding more contributions on GitHub.

Best regards,
@STICKnoLOGIC
github-token: ${{ secrets.FA_TOKEN }}
- uses: "pascalgn/[email protected]"
if echo "$CHANGED_FILES" | grep -q '"removed"'; then
gh pr comment ${{ github.event.pull_request.number }} \
--body "Hey @${{ github.event.pull_request.user.login }}! Thank you for your contribution.\nEven though you decided to remove your contribution, we truly appreciate your effort.\n\nBest Regards,\n@STICKnoLOGIC"
else
gh pr comment ${{ github.event.pull_request.number }} \
--body "Hi @${{ github.event.pull_request.user.login }}! Your contribution has been merged.\nKeep building your skills and check out [these resources](https://github.com/firstcontributions/first-contributions).\n\nBest regards,n@STICKnoLOGIC"
fi
env:
GITHUB_TOKEN: ${{ secrets.FA_TOKEN }}
MERGE_LABELS: "ready to merge"
MERGE_REMOVE_LABELS: "ready to merge"
GH_TOKEN: ${{ secrets.FA_TOKEN }}


Loading