-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This configuration: - Utilizes repository_dispatch for flexibility. - Ensures secure handling of secrets. - Provides notifications and logging for audit purposes. - Could potentially integrate scanning of the repository for issues as a cron job within GitHub Actions, if periodic scanning is needed.
- Loading branch information
Showing
1 changed file
with
61 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,61 @@ | ||
name: Deployment Automation | ||
|
||
on: | ||
issues: | ||
types: [opened, labeled] | ||
repository_dispatch: | ||
types: [deploy_trigger] | ||
|
||
jobs: | ||
deploy: | ||
runs-on: ubuntu-latest | ||
if: contains(github.event.issue.labels.*.name, 'deployment') || github.event.action == 'deploy_trigger' | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Set up Git user | ||
run: | | ||
git config user.name "GitHub Action" | ||
git config user.email "action@github.com" | ||
- name: Create Branch | ||
id: create_branch | ||
env: | ||
DEPLOY_TOKEN: ${{ secrets.DEPLOY_TOKEN }} | ||
run: | | ||
BRANCH_NAME="deploy-${{ github.event.issue.number }}" | ||
git checkout -b $BRANCH_NAME | ||
git push origin $BRANCH_NAME | ||
echo "::set-output name=BRANCH_NAME::$BRANCH_NAME" | ||
- name: Create Project Board | ||
uses: alex-page/github-project-automation-plus@v0.8.1 | ||
with: | ||
project: 'Deployment Project' | ||
column: 'To do' | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Fork Repository | ||
run: | | ||
curl \ | ||
-X POST \ | ||
-H "Authorization: token ${{ secrets.DEPLOY_TOKEN }}" \ | ||
-d '{"organization": "new-org", "repo": "${{ github.repository }}"}' \ | ||
"https://api.github.com/repos/${{ github.repository }}/forks" | ||
- name: Notify Completion | ||
if: success() | ||
uses: actions/github-script@v5 | ||
with: | ||
script: | | ||
github.issues.createComment({ | ||
issue_number: context.issue.number, | ||
owner: context.repo.owner, | ||
repo: context.repo.repo, | ||
body: 'Deployment workflow completed successfully.' | ||
}) | ||
- name: Log Action | ||
run: | | ||
echo "Deployment process for issue ${{ github.event.issue.number }} completed" >> deployment_log.txt |