generated from datalad/datalad-extension-template
-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Import tributors update workflow from core
- Loading branch information
Showing
1 changed file
with
86 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
name: allcontributors-auto-detect | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
Update: | ||
name: Generate | ||
runs-on: ubuntu-latest | ||
if: contains(github.repository, 'datalad/datalad-next') | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Tributors Update | ||
uses: con/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
|
||
# Single text list (space separated) of parsers, leave unset to auto-detect | ||
parsers: unset | ||
|
||
# Update lookup with GitHub metadata | ||
update_lookup: github | ||
|
||
# Skip these users (example) | ||
skip_users: | ||
|
||
# INFO, DEBUG, ERROR, WARNING, etc. | ||
log_level: DEBUG | ||
|
||
# If files already exist and an init is done, force overwrite | ||
force: true | ||
|
||
# the minimum number of contributions required to add a user | ||
threshold: 1 | ||
|
||
- name: Checkout New Branch | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
BRANCH_AGAINST: "main" | ||
run: | | ||
printf "GitHub Actor: ${GITHUB_ACTOR}\n" | ||
export BRANCH_FROM="contributors/update-$(date '+%Y-%m-%d')" | ||
git remote set-url origin "https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git" | ||
BRANCH_EXISTS=$(git ls-remote --heads origin ${BRANCH_FROM}) | ||
if [[ -z ${BRANCH_EXISTS} ]]; then | ||
printf "Branch does not exist in remote.\n" | ||
else | ||
printf "Branch already exists in remote.\n" | ||
exit 1 | ||
fi | ||
git branch | ||
git checkout -b "${BRANCH_FROM}" || git checkout "${BRANCH_FROM}" | ||
git branch | ||
git config --global user.name "github-actions" | ||
git config --global user.email "[email protected]" | ||
git status | ||
if git diff-index --quiet HEAD --; then | ||
export OPEN_PULL_REQUEST=0 | ||
printf "No changes\n" | ||
else | ||
export OPEN_PULL_REQUEST=1 | ||
printf "Changes\n" | ||
git commit -a -m "Automated deployment to update contributors $(date '+%Y-%m-%d') | ||
[skip ci]" | ||
git push origin "${BRANCH_FROM}" | ||
fi | ||
echo "OPEN_PULL_REQUEST=${OPEN_PULL_REQUEST}" >> $GITHUB_ENV | ||
echo "PULL_REQUEST_FROM_BRANCH=${BRANCH_FROM}" >> $GITHUB_ENV | ||
echo "PULL_REQUEST_TITLE=[tributors] ${BRANCH_FROM}" >> $GITHUB_ENV | ||
echo "PULL_REQUEST_BODY='Tributors update automated pull request.\n\n[skip ci]'" >> $GITHUB_ENV | ||
- name: Open Pull Request | ||
uses: vsoch/[email protected] | ||
if: ${{ env.OPEN_PULL_REQUEST == '1' }} | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
PULL_REQUEST_BRANCH: "main" |