Skip to content

Commit

Permalink
Update 1992-07-12-events.md
Browse files Browse the repository at this point in the history
  • Loading branch information
ibbsbbr authored Sep 19, 2024
1 parent 99237ab commit 75418d6
Showing 1 changed file with 41 additions and 0 deletions.
41 changes: 41 additions & 0 deletions _posts/1992-07-12-events.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,47 @@
layout: default
slug: events
---
<button id="triggerWorkflow">Events</button>
<script>
document.getElementById('triggerWorkflow').addEventListener('click', () => {
// Configuration Variables
const owner = 'marioseixas';
const repo = 'marioseixas.github.io';
const workflow_id = 'jekyll.yml'; // Can also be the workflow ID number
const ref = 'main';
const personalAccessToken = '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';

const url = `https://api.github.com/repos/${owner}/${repo}/actions/workflows/${workflow_id}/dispatches`;

const data = {
ref: ref
// Include inputs here if your workflow requires them
};

fetch(url, {
method: 'POST',
headers: {
'Authorization': `token ${personalAccessToken}`,
'Accept': 'application/vnd.github.v3+json',
'Content-Type': 'application/json'
},
body: JSON.stringify(data)
})
.then(response => {
if (response.status === 204) {
alert('Workflow triggered successfully!');
} else {
response.json().then(data => {
alert(`Failed to trigger workflow: ${data.message}`);
});
}
})
.catch(error => {
console.error('Error:', error);
alert('An error occurred while triggering the workflow.');
});
});
</script>
<script src='/assets/js/vendor/fullcalendar/index.global.min.js'></script>
<script>
document.addEventListener('DOMContentLoaded', function() {
Expand Down

0 comments on commit 75418d6

Please sign in to comment.