Skip to content

Topics wont work yet #33

Topics wont work yet

Topics wont work yet #33

name: PublicOrganisation Check and Update
on:
push:
branches:
- main
jobs:
check:
runs-on: ubuntu-latest
steps:
- name: Check Organization Name
run: |
if [[ "${{ github.repository }}" != *".github"* ]]; then
echo "This workflow can only be run within .github organizations."
exit 1
fi
- name: Checkout code
uses: actions/checkout@v2
- name: Fetch Organization Details
run: |
ORG_DETAILS=$(curl -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
https://api.github.com/orgs/${{ github.repository_owner }})
- name: Print GitHub Object
run: |
echo "GitHub Object:"
echo $REPO_DETAILS | jq
- name: Check and Update publicorganisation.yaml
run: |
ORGANISATION_NAME="${{ github.event.repository.owner.login }}"
ORGANISATION_AVATAR=$(echo $REPO_DETAILS | jq -r '.owner.avatar_url')
ORGANISATION_EMAIL=$(echo $REPO_DETAILS | jq -r '.owner.email')
if [ ! -f "publiccode.yaml" ]; then
echo "publiccode.yaml does not exist, creating one."
touch publiccode.yaml
fi
if [ "$ORGANISATION_NAME" != "null" ]; then
echo "name: $ORGANISATION_NAME" > publiccode.yaml
fi
- name: Commit changes
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add publicorganisation.yaml
git commit -m "Update publicorganisation.yaml with org details" || echo "No changes to commit"
git push